2014-01-07 138 views
1

我这里有在警予下拉,看起来像这样:如何设置默认值下拉

<?php echo $form->dropDownList($model, 'is_enabled', 
array('0'=>'No', '1'=>'Yes'), array('id'=>'new-sys-user-is_enabled',));?> 

与此问题是,它显示了“否”,因为它有0键。我想默认显示'是'。这是什么解决方法?

回答

0

我想你应该尝试像这样...

<?php echo $form->dropDownList($model, 'is_enabled', array('1'=>'Yes', '0'=>'No'), array('id'=>'new-sys-user-is_enabled',));?> 

值你想保持默认值,然后在数组中保持第一。

谢谢