Just make sure your model has a cat_id property. Somewhere in your controller just
$model->cat_id = filter_input_array(INPUT_GET, 'cat_id');
or
$modelArray = filter_input_array(INPUT_GET, 'nameofmodel'); $model->cat_id = $modelArray['cat_id'];
If you really want to do this, just like you, you might need to use the model name too.
<?= $form->field($model, 'cat_id')->dropDownList(ArrayHelper::map(DeviceCats::find()->where(['is_deleted' => 'no'])->all(),'id','title'),['options' => [$_GET['SOMETHIGNHERE']['cat_id'] => ['selected'=>true]], 'prompt' => ' -- Select Category --']) ?>
Mihai P.
source share