Changes
Title
unchanged
A simple action for CJuiAutoComplete
Category
unchanged
Tips
Yii version
unchanged
Tags
unchanged
autocomplete, actions
Content
changed
###Scenario
More or less I use auto-complete field for a form. [CJuiAutoComplete](http://www.yiiframework.com/doc/api/1.1/CJuiAutoComplete) is a yii widget for this purposes.
The common use case is to make an ajax request and retrieve a list from the database. So in this case you have to write a controller action to return you a json encoded list.
What if I had a generic action to do this work for me?
###
EAutoCompleteAcImplementation
This is a class that extends CAction to do the work for me.[...]
./webapp/protected/extensions/EAutoCompleteAction.php
~~~
###
How to uUse
And in my controller I declare this action in the public actions function:
####Declare action in controller[...]
'model'=>$model,
'sourceUrl'=>array('my/aclist'),
'name'=>'my_input_name',
'options'=>array(
'minLength'=>'3',
),
'htmlOptions'=>array(
'size'=>45,
'maxlength'=>45,[...]