php - how to add empty field to activeDropDownList yii2? -
i have drop down list using arrayhelper::map below code:
<?= html::activedropdownlist($model2, 'expert_id', arrayhelper::map(experts::find()->all(), 'username', 'username')) ?>
that works correctly want add empty fields or other favorite fields ... how can that?
try use array merge
<?= html::activedropdownlist($model2, 'expert_id', array_merge(array('val1'=>'val1'), arrayhelper::map(experts::find()->all(), 'username', 'username'))) ?>
Comments
Post a Comment