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.
精彩评论