Revision #2 has been created by c@cba on Feb 12, 2012, 3:53:50 PM with the memo:
enumDropDownList
« previous (#1) next (#3) »
Changes
Title
unchanged
Drop down list with enum values for column of type ENUM >+> incorporate into giix
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
drop down list, input, forms, views, enum, giix
Content
changed
[...]
Create the file `..\components\ZHtml.php` with the following code:
```php
class ZHtml extends CHtml
{
/**
* This code was contributed by zaccaria in the forum:
* http://www.yiiframework.com/forum/index.php?/topic/10079-enum-db-type-in-yii/
* This method generates a drop down list for columns of type ENUM.
* @param CModel $model The data model.
* @param string $attribute The attribute.
* @param array $htmlOptions Addtional HTML options.
* @return string The generated drop down list with the enum values for the attribute.
*/
public static function enumDropDownList($model, $attribute, $htmlOptions=array())
{
return CHtml::activeDropDownList( $model, $attribute, self::enumItem($model, $attribute), $htmlOptions);
}[...]