当我在CHtml :: dropDownList()中为选项添加额外的atrribute时,我无法设置所选的选项。
如果不向CHtml :: dropDownList()添加额外的属性,我可以选择一个选项,其代码为
echo CHtml::dropDownList("rating[$i]", '', CHtml::listData(Rating::model()->findAll($criteria), 'id', 'Description'), array('prompt' => 'Select a rating', 'options' => array($question->rating_id => array('selected' => TRUE)), 'class' => 'input-xlarge ddc hrq'));
但是当我添加额外的atrribute,选择的选项不起作用时,修改后的代码是
echo CHtml::dropDownList("rating[$i]", '', CHtml::listData(Rating::model()->findAll($criteria), 'id', 'Description'), array('prompt' => 'Select a rating', 'options' => array($question->rating_id => array('selected' => TRUE), '1' => array('number' => 5), '2' => array('number' => 4), '3' => array('number' => 3), '4' => array('number' => 2), '5' => array('number' => 1), '16' => array('number' => 0)), 'class' => 'input-xlarge ddc hrq'));
请帮我解决这个问题。 在此先感谢:)