2014-01-07 144 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',));?> 

值你想保持默認值,然後在數組中保持第一。

謝謝