how to include CJuiAutoComplete widget in home page..
I am writting the actionAutocompleteTest($term) function to C:\wamp\www\protected\modules\apartments\controllers\backend\MainController.php
public function actionAutocompleteTest($term)
{
$res =array();
$qtxt ="SELECT name_en FROM {{location_city}} WHERE name_en LIKE :username";
$command =Yii::app()->db->createCommand($qtxt);
$command->bindValue(":username", '%'.$term.'%', PDO::PARAM_STR);
$res =$command->queryColumn();
echo CJSON::encode($res);
Yii::app()->end();
}
and this is my second file where i call above function
C:\wamp\www\themes\atlas\views\site\_search_field_term.php
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'apartment',
'value'=>'test21',
'source'=>$this->createUrl('/apartments/backend/main/autocompleteTest'),
'options'=>array(
'delay'=>300,
'minLength'=>1,
'showAnim'=>'fold',
'focus'=>'js:function(event, ui) {
$("#xx").val(ui.item.label);
return false;
}',
'select'=>"js:function(event, ui) {
$('#xx').val(ui.item.label);
return false;
}",
),
'htmlOptions'=>array(
'size'=>'40'
),
));
?>
But its not work properly..plz suggest me how to include CJuiAutoComplete widget