Using CAutoComplete to display one value and submit another

Comparing #4 with #5

Revision #5 was created by jonah jonah on Mar 25, 2009, 11:57:10 PM.

implanted maximum limit

Content

[...]
/* q is the default GET variable name that is used by
/ the autocomplete widget to pass in user input
*/
$name = $_GET['q'];
// this was set with the "max" attribute of the CAutoComplete widget
$limit =
min($_GET['limit'], 50);
$criteria = new CDbCriteria;
$criteria->condition = "name LIKE :sterm";
$criteria->params = array(":sterm"=>"%$name%");
$criteria->limit = $limit;
$userArray = User::model()->findAll($criteria);
[...]