CJuiAutoComplete not calling controller action

CJuiAutoComplete is not working for me. It appears that my controller action is not being called. The debugger never breaks in the actionLookup function nor does the echo display. Also, I cannot get it to work if I set the source to a simple array of items. What am I doing wrong? Help would be much appreciated.


            <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(

                        'model' => $model,

                        'attribute' => 'zipcode',

		    'source' => $this->createUrl('address/lookup'),

                        'name' => 'zipcode',

                        'value' => $model->zipcode,

		    'htmlOptions' => array('size'=>'5'),

                        'options' => array(


                            'minLength' => 1, // min chars to start search


                    )) ?>


public function accessRules()


	return array(

		array('allow',  // allow all users to perform 'index' and 'view' actions




		array('allow', // allow authenticated user to perform 'create' and 'update' actions




		array('allow', // allow admin user to perform 'admin' and 'delete' actions




		array('deny',  // deny all users





public function actionLookup()


    echo "Zipcode Lookup!";


You have to set the

'sourceUrl'=> $this->createUrl('address/lookup')

, attribute (not ‘source’).

I tried that as well. Doesn’t work for me.

Ok, ‘source’ should work too.

  • But are you shure, that the url is not called?

echo "Zipcode Lookup!"; is not a valid json that the autocomplete expects.

Return a valid json array: f.e. json_encode(array(‘1’, ‘2’, ‘3’)) and add Yii::log(…) in the function actionLookup()

  • If you have ensured the url is not called, you can take a look at the html-source and check the generated url.

Try to call this url manually.

  • Remove the accessRules and try again

after looking at firebug I see that it is reporting errors saying jQuery is not defined. I also see that my CJuiDatePicker is no longer working as well. I don’t know what changed but I have to assume that these issues are related.