Yii Framework Forum: How Can Add Css Style Name As Class Option Here? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How Can Add Css Style Name As Class Option Here? Rate Topic: -----

#1 User is offline   logudotcom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-July 13
  • Location:Chennai, India

Posted 17 January 2014 - 08:17 AM

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))));

Attached File(s)

  • Attached File  form.png (17.34K)
    Number of downloads: 3

0

#2 User is offline   Selvakumar 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 92
  • Joined: 14-August 13

Posted 17 January 2014 - 09:55 AM

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...
0

#3 User is offline   logudotcom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-July 13
  • Location:Chennai, India

Posted 17 January 2014 - 11:13 AM

Hi,

I am getting this error,

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

#4 User is offline   logudotcom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-July 13
  • Location:Chennai, India

Posted 17 January 2014 - 11:38 AM

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>

0

#5 User is offline   logudotcom 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 04-July 13
  • Location:Chennai, India

Posted 18 January 2014 - 12:16 AM

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"));

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users