I am new to yii…
I want to create model and form using Gii,
In my database table i used enum data type for specific values to select by user.
than i generate model and crude using Gii but it doesn’t create drop-down list in form for that enum field.
for create that drop-down using Gii what should i have to do. or change templates of Gii.
please help me. Thanks in advance…
As far as I’m aware, Gii doesn’t attempt to read the options in enumerations, probably because lots of DBMSs don’t support that structure.
I normally handle it by creating a static method within the model called getXOptions(), where X is the field name. For example:
public static function getStatusOptions()
You can use this in your rules too, if you want to ensure that only valid options are provided:
public function rules()
array('status', 'in', 'range'=>array_keys(self::getStatusOptions())),
It doesn’t work …please help me out what should i have to add in default view template of Gii CRUD generator…
See if this thread helps.
Thank you, But I already see but it doesn’t work for me…
Hav you visited below link
i think it may b useful for your need
i didn’t see it. thank you.
I think and will work for it. thank you so much…
It works but i want to use it in form generator of Gii… how use it in form generator.
which automatically get data type from table and if it’s ENUM than generate drop-down for that field…
thank you …done it using this link…