Revision #5 has been created by jonah on Mar 25, 2009, 11:57:10 PM with the memo:
implanted maximum limit
« previous (#4) next (#6) »
Changes
Title
unchanged
Using CAutoComplete to display one value and submit another
Category
unchanged
Tutorials
Yii version
unchanged
Tags
unchanged
Content
changed
[...]
/* 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);[...]