Difference between #7 and #8 of
Using CAutoComplete to display one value and submit another

Revision #8 has been created by rainyjune on Jun 16, 2010, 2:51:27 AM with the memo:

add Chinese version
« previous (#7) next (#9) »

Changes

Title unchanged

Using CAutoComplete to display one value and submit another

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

Content changed

[...]
?>
<?php echo CHtml::hiddenField('user_id'); ?>
```
Take note of the `methodChain` attribute being used. MethodChain essentially appends (or chains) a javascript method to the end of the AutoComplete javascript code that will be generated. This particular method is the `result` method, which fires when an autocomplete item is selected. The code inside of the result function basically references the hidden field that was defined and assigns the 2nd part (part after the pipe) of the selected autocomplete data to that field.

Now that the basics are out of the way, review the documentation for [Yii's CAutoComplete widget](http://www.yiiframework.com/doc/api/CAutoComplete) and [jQuery's Autocomplete plugin](http://plugins.jquery.com/project/jq-autocomplete) to find more ways to customize and use autocomplete functionality in your Yii project.

 
 
### Links
 
[Chinese version](http://dreamneverfall.cn/node/95)
7 3
11 followers
Viewed: 65 514 times
Version: 1.1
Category: Tutorials
Written by: luoshiben
Last updated by: mohammad sharif ahrari
Created on: Mar 25, 2009
Last updated: 12 years ago
Update Article

Revisions

View all history