Tuesday, March 13, 2012

Alternative Way to make Dropdown menu in yii

Maybe you are a newbie and want to make dropdown in yii just like me before. Oke to make dropdown menu in yii is simple. You can use this solution to make your Dropdown list..
Maybe you can check my post before here

From there you can use this in two ways of using dropdown list in yii framework

The first one is just like my post before :

<div class="row">
  <?php echo $form->dropDownList($model,'country_id',
   CHtml::listData(Country::model()->findAll(), 'id', 'country_name'),
   array('empty'=>'Select Country'))?>
 </div>

And the other option is using CHtml::dropDownList like this suppose you have to make your view class with the Users model

<div class="row">
  <?php echo CHtml::dropDownList('Users[country_id'],'',
   CHtml::listData(Country::model()->findAll(), 'id', 'country_name'),
   array('empty'=>'Select Country'))?>
 </div>
That's the other option that you can choose..

1 comment:

  1. It is really very helpful for us and I have gathered some important information from this blog. For more information about best Oracle training institutes please Click Here

    ReplyDelete