I am using active form in my view like
<?= $form->field($model, 'ishead')
->dropDownList(
array(
"1" => "I'm a Head",
"0" => "I'm not a head"
),
['prompt'=>'-Select a head type-']
)
?>
By js, I have set the value and disable that dropdown
$("#register-ishead").val('1');
$("#register-ishead").prop("disabled", true);
When i submit the form, im not able to get that value of disable drop down value.
Is this procedure right? or How to do that
First create a hidden field in the form.
After the below code just assign the value to hidden field. then only it will go after submit.
Readonly does not work in dropdown. You have to use disabled and keep the data in hidden field.