Validation of 2 way dependent dropdown

<?= $form->field($model, ‘booking_date’)->widget(DatePicker::classname(), [

‘options’ => [‘placeholder’ => ‘’,

‘id’=>‘avail_date’,

‘onchange’=>’

$.get( “’.Url::toRoute(‘doctors/avail_search’).’”, { id: $(this).val() } )

.done(function( data )

{

$( “select#avail_practice’.$user->id.’” ).html( data );

});

],

‘readonly’ => false,

‘pluginOptions’ => [

‘autoclose’ => true,

‘format’ => ‘dd-mm-yyyy’,

‘value’=>date(‘d-m-Y’),

‘todayHighlight’ => true,

‘todayBtn’ => true,

‘pickerPosition’=> “bottom-right”,

]

]);

?>

<label>Location</label>

<?php

$location=ArrayHelper::map(DoctorAdditionalPractice::find()->where(‘doctor_id=:doctor’,[‘doctor’=>$id])->all(), ‘id’,‘name’);

echo $form->field($model,‘doc_practice_locatoin_id’)->dropDownList($location,[‘id’=>‘avail_practice’.$user->id.’’,

‘prompt’=>‘Select’,

‘onchange’=>’

$.get( “’.Url::toRoute(‘doctors/avail_slot’).’”, { id: $(this).val(),ids:$("#avail_date).val()} )

.done(function( data )

{

$( “select#avail_s’.$user->id.’” ).html( data );

});

])->label(’’);

?>

validation of the field is not working

You overwritted the id of “doc_practice_locatoin_id” to ‘avail_practice’.$user->id.’. so auto generated js not validating the field