Answer the question
In order to leave comments, you need to log in
How to make the select parameter empty initially?
I use the search Model for searching. In order not to write the category for the search by hand, I did it like this.
<?= $form->field($model, 'category_id')->dropDownList(ArrayHelper::map(Category::find()->all(), 'id','name'),['style'=>'font-family: \'Exo 2\', sans-serif; color: #0f0f0f; font-size:17px'])->label('Отделение')?>
Answer the question
In order to leave comments, you need to log in
<?= $form->field($model, 'category_id')->dropDownList(['' => 'Укажите отделение'] + ArrayHelper::map(Category::find()->all(), 'id','name'),['style'=>'font-family: \'Exo 2\', sans-serif; color: #0f0f0f; font-size:17px'])->label('Отделение')?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question