Revision #2 was created by zaccaria on Mar 28, 2012, 7:21:47 AM.
security
Content
[...]
Often you can solve with a foreign field, with an interface for add a new color. That's great if adding new color is a quite rare operation, if it happens too often and if the users are too stupid for remember how to add a color, it can be odd.
I propose an half way solution: a free text with autocomplete based on history values.
Add this to an CHtml We will use CJuiAutoComplete, what we need is a efficient way for perform searches.
Add this to your components/extensions:
```php
class ZHtmlSearchAction extends CHtmlAction
{
public function activeTextFieldHistory($model, $attribute, $htmlOptions=null)
$model;
public $attribute;
public $criteria=array('limit'=>5);
public function run()
{
$mod=$model;
$attr=$attribute;
self::resolveNameID($mod,$attr,$htmlOptions
$criteria=new CDbCriteria($this->criteria);
$criteria->addCondition("{$this->attribute} IS NOT NULL AND {$this->attribute} LIKE :param");