Hi
I start using yii form last month and exploring its features.All are so smart
Thanks to yii team.
My Point is
When creating From with the help of gii tool
Form Field should be dropdown against ‘ENUM’ Type of mysql database.
Is it ok?
Hi
I start using yii form last month and exploring its features.All are so smart
Thanks to yii team.
My Point is
When creating From with the help of gii tool
Form Field should be dropdown against ‘ENUM’ Type of mysql database.
Is it ok?
is it ok, but is not the default implementation.
For have a dropdowl list, use this code in your view/form.php:
$enum=$model->tableSchema->columns['attribute']->dbType;
$off=strpos($enum,"(");
$enum=substr($enum, $off+1, strlen($enum)-$off-2);
$keys=str_replace("'",null,explode(",",$enum));
for($i=0;$i<sizeof($keys);$i++)
$values[$keys[$i]]=Yii::t('enumItem',$keys[$i]);
$htmlOptions['prompt']='';
return CHtml::activeDropDownList($model,'attributes',
$values,
$htmlOptions);
@zaccaria Thnks for code sample
but i was just wondering if gii can be so smart to handle such option.
Else there are other ways ofcourse.
You can personalize gii by exteding it, in order to add this feature and generate code more close to your final need.
Thnks Boss