for my drop-down list I am using this code.
= $form->field($medicinerequest, \'[\' . $id . \']\' . \'medicine_name\')
->DropDownList(ArrayHelper::
You can set $var in kartik Depdrop widget, as the same scenario in the Dropdown widget here We use kartik depdrop widget
where(['id' => $model->customer_id])->all(), 'id',
function ($model) {
return $model['id'] .' - '. $model['name'];
});
echo $form->field($model, 'id')->widget(DepDrop::classname(), [
'data' => $var,
'pluginOptions' => [
'depends' => [''],
'url' => Url::to(['#'])
]
]) ?>