S
S
Sergey Melnikov2015-08-20 16:29:44
Yii
Sergey Melnikov, 2015-08-20 16:29:44

How to set default value in dropdownlist?

Help plz, How to define default value in yii2 dropdownlist?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
corpsepk, 2015-08-20
@corpsepk

www.yiiframework.com/doc-2.0/yii-helpers-basehtml....

<?= $form->field($model, 'status')->dropDownList($array, ['prompt' => 'значение по дефолту']) ?>

M
matperez, 2015-08-20
@matperez

By default, what is set in the model will be selected. The prompt specifies the string that is shown when nothing is selected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question