I am using the Kartik Depdrop widget.
Everything is working fine except in the situation where I have not selected a value on creation of new record, on update the dependent field should show Please select whereas it is showing the first value in the drop-down and it is getting saved on update, whereas I want the value of 'please select' i.e. null to be saved even on update depending on the situation.
Example- I select a room-category - dependant value is packages, which can be null as well. So I didn't select any value in the dependent field packages. But when I come to update the form the first value in the drop-down is showing by default, whereas I want the please select as the default.
How can correct this?
$form->field($model, 'package')->widget(DepDrop::classname(), [
'data'=>ArrayHelper::map(\app\models\Package::find()->all(), 'id', 'package_name' ),
'pluginOptions'=>[
'depends'=>['room_category'],
'placeholder'=>'Select...',
'url'=> \yii\helpers\Url::to(['patient-detail/subcat']),
]
])
Note:If I am selecting a value in the dependant dropdown on creation, then the value on update is showing correctly.
selectin the update screen, if no data is selected at the time of creation. - Pawan