How Can Add Css Style Name As Class Option Here?

I have this code to display dynamic drop down list with condition, like




echo $form->dropDownList($memberVariousCommunityModel,'monthFrom[]',$model->getMonths(), array('options' => array(''.$memberVariousCommunity->monthFrom.''=>array('selected'=>true))));



I am unable to add this css style due to this my form looks like attached.


array('class'=>'span12')

I tried this but it does not work,


echo $form->dropDownList($memberVariousCommunityModel,'monthFrom[]',$model->getMonths(),

				  array('class'=>'span12'), array('options' => array(''.$memberVariousCommunity->monthFrom.''=>array('selected'=>true))));

Hi,


echo $form->dropDownList($memberVariousCommunityModel,'monthFrom[]',$model->getMonths(),                                  

array('htmlOptions'=>array('class'=>'span12'), array('options' => array(''.$memberVariousCommunity->monthFrom.''=>array('selected'=>true)))));

You can just try this one. i think this will help you…

Hi,

I am getting this error,

htmlspecialchars() expects parameter 1 to be string, array given

timebeing, i fixed this way, it is ok but let me know if there is any proper way …




<style type="text/css">

	select#MemberVariousCommunity_monthFrom{width:100%}

</style>



Finally this worked out ,


 echo $form->dropDownList($memberVariousCommunityModel,'houseId[]',CHtml::listData( House::model()->findAll(array('order'=>'name ASC')), 'id', 'name' ),array('options' => array($memberVariousCommunity->houseId=>array('selected'=>true)),"class"=>"span12"));