How can I make it keep the option selected when the form is re-displayed?
How can I make it keep the option selected when the form is re-displayed?
Use activeDropdownList and attach it to a model:
CHtml::activeDropdownList($model, $attribute)
I think…
I dnt think that’s the correct method. Can anyone else advise?
datashaman is right! ActiveDropDOwnList is the way you must go! Just check the documentation:
ActiveDropDownList
Or do this:
CHtml::dropDownList('name', $_REQUEST['name'])
if you don’t use a model. That way you can also define defaults on your form by adding them as query parameters
Cheers datashaman!