Open jainabhishek14 opened 7 years ago
How to set default Value of dropDownList field I have tried
$form->field($addressModel, "[{$index}]city_id")->dropDownList( ArrayHelper::map(City::find()->all(), 'id', 'name'))
$form->field($addressModel, "[{$index}]city_id")->dropDownList( ArrayHelper::map(City::find()->all(), 'id', 'name'), ['options' => [ 4 => ['Selected' => true], ], ])
but nothing works
Solution
$(function () { $(".dynamicform_wrapper").on("afterInsert", function(e, item) { $(item).find("select[id$='-city_id']").val(4); }); });
How to set default Value of dropDownList field I have tried
but nothing works