So I am really struggling with this one. I just don’t understand what is going on at all.
I am using the CJuiAutoComplete. Normally this works quite well this way, maybe I am just screwing something up.
Code in views/group/view.php
<?php
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
'name'=>'firstname',
'value'=>'Name',
'source'=>$this->createUrl('contacts/auto'),
// additional javascript options for the autocomplete plugin
'options'=>array(
'showAnim'=>'fold',
),
));
?>
Code in ContactsController.php
public function actionAuto() {
$res =array();
if (isset($_GET['term'])) {
// http://www.yiiframework.com/doc/guide/database.dao
$qtxt ="SELECT firstname FROM {{Contacts}} WHERE firstname LIKE :firstname";
$command =Yii::app()->db->createCommand($qtxt);
$command->bindValue(":firstname", '%'.$_GET['term'].'%', PDO::PARAM_STR);
$res =$command->queryColumn();
}
echo CJSON::encode($res);
Yii::app()->end();
}
Now here is where it gets weird. If I change the the function to anything other than actionAuto() it simple no longer works. I have no idea why.
Any ideas?