my predecessor in the project didn’t save drop down list values in a table; they were in the html file…The guy also didn’t use $form->dropdownList() to create the selects…
Of course I had now huge problems for pre-selecting values on editing; thus I changed all <select> to $form->dropdownList().
But now I have a different problem, as
echo $form->dropdownList($model,'location',
array("Art","Gallery","Bar","Club"));
Now produces integer values for the DB…
I know I can set the display value like so:
array(“Art” => “Art”)….
but I would rather like to avoid that – there are a bunch of views displaying the value directly… 🙁
Is there a way to tell yii that the DB values shall be the same as the display value?
You can override
dropDownListmethod ofCActiveFormwidget as follows:and then use it like this: