How I can set "selected" option in dropDownList?
$form->dropDownList($model,'sex',array('1'=>'men','2'=>'women'));
Like that:
<select name="sex">
<option value="1">men</option>
<option value="2" selected="selected">women</option>
How I can set "selected" option in dropDownList?
$form->dropDownList($model,'sex',array('1'=>'men','2'=>'women'));
Like that:
<select name="sex">
<option value="1">men</option>
<option value="2" selected="selected">women</option>
Try this:
$form->dropDownList($model,'sex',array('1'=>'men','2'=>'women'), array('options' => array('2'=>array('selected'=>true))));
For more info on htmlOptions visit this page http://www.yiiframework.com/doc/api/CHtml#activeDropDownList-detail
bettor , u r a life saver. Thank you very much.
Thanks bettor …it helps for me…
Thanks helped me too
Works for me, thx. ;]
[b] bettor
[/b]
Thanks Work For me too V
Thanks in advance.
Thanks =)
Thanks, helped me too.
Thanks for make it working
Good one. It’s very useful.
Thanks a lot
Thanks Work For me too
ty