开发者

Issue with Yii's listData

I have a model called managers, I want to create a drop down list that pulls the managers names based on the managers id. I am using the code below

e开发者_StackOverflow社区cho $form->dropDownList
(
  $model,'country', 
  CHtml::listData(Country::model()->findAll(), 'id', 'value1','value2'), 
  array('empty'=>;'--please select--')
);

The drop down list actually gives me the desired names('value') but wont display the default empty array value, how can I get the 'please select' bit displaying?


echo $form->dropDownList
(
  $model,'country', 
  CHtml::listData(Country::model()->findAll(), 'id', 'value1','value2'), 
  array('prompt'=>'--please select--')
);

The prompt keyword should do the trick. That's how I display it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜