Difference between #1 and #3 of
A simple action for CJuiAutoComplete

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,
[...]
15 1
19 followers
Viewed: 49 587 times
Version: 1.1
Category: Tips
Written by: tydeas_dr
Last updated by: Thiago Souza
Created on: Mar 23, 2011
Last updated: 13 years ago
Update Article

Revisions

View all history