Page 1 of 1

CJuiAutoComplete autocomplete

PostPosted: 28 Mar 2016, 16:26
by Ashwini
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

Re: CJuiAutoComplete autocomplete

PostPosted: 29 Mar 2016, 13:51
by fisher
We should take a look at your site and see what changes were done.
Right now we can't give any instructions.