A Tricky Htmloptions Problem

Please see this wiki: http://www.yiiframework.com/wiki/143/htmloptions-explained-for-various-controls/

I have something very similar to that:




$items = array("1" => "first", "2" => "second");

$options["options"] = array("1"=>array("selected" => "selected"), "2"=>array("selected"=>"selected"));

echo CHtml::dropDownList("myDropDown", null, $items,$options);



But the problem is as my drop-down list is a multiple select, so where should I put the keyword "multiple" in the above code to produce HTML like this:




<select multiple="multiple" name="myDropDown" id="myDropDown"> 

<option value="1" selected="selected">first</option> 

<option value="2" selected="selected">second</option> 

</select>



Thank you in advance!


$options['multiple'] = 'multiple';

Hi Keith, where in the above code do I suppose to put that in? I really can not figure this out. Thanks for your help!




$items = array("1" => "first", "2" => "second");

$options["options"] = array("1"=>array("selected" => "selected"), "2"=>array("selected"=>"selected"));

$options['multiple'] = 'multiple';

echo CHtml::dropDownList("myDropDown", null, $items,$options);