R
R
Rawe No2021-07-08 17:10:49
Yii
Rawe No, 2021-07-08 17:10:49

How to pass array to dropDownList Yii2 Active Form?

Good afternoon!
How to pass array to dropDownList Yii2 ActiveForm?
Here is the code:

<?= $form->field($model, 'tags')->dropDownList($tags,['options'=>[$selectedTags=>['Selected'=>true]],'multiple' => true]) ?>

Here's how to make multiple items in a dropDownList be selected ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaliy K, 2021-07-11
@revenger

$tags - pass the key-value array there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question