I'm new to Yii2 and web-application development at all. I have an Kartik ActiveForm which includes a Checkbox to select if the user is also a driver. Only when this checkbox is checked, the following field "RFID Number" should be enabled, else should be disabled.
How can I implement this functionality? Following my user form code:
<?= Form::widget([
'model'=>$model,
'form'=>$form,
'columns'=>2,
'attributes'=>[
'username'=>['type'=>Form::INPUT_TEXT ],
'permission'=>[
'type'=>Form::INPUT_DROPDOWN_LIST,
'items' =>[$authItems],
'options'=>['prompt' => Yii::t('app', 'Select User Role')]],
'user_is_driver'=>['type'=>Form::INPUT_CHECKBOX ],
'rfid_number'=>['type'=>Form::INPUT_TEXT,'options'=>['disabled' => true]],
'forename'=>['type'=>Form::INPUT_TEXT ],
'lastname'=>['type'=>Form::INPUT_TEXT ],
'email'=>['type'=>Form::INPUT_TEXT ],
'fone'=>['type'=>Form::INPUT_TEXT ],
'mobile'=>['type'=>Form::INPUT_TEXT ],
'company_id'=>[
'type'=>Form::INPUT_DROPDOWN_LIST,
'items' =>[ArrayHelper::map(Company::find()->all(),'id_company','name')],
'options'=>['prompt' => Yii::t('app', 'Select Company')]],
'password'=>['type'=>Form::INPUT_PASSWORD ]
]
]); ?>
Thanks for any help!
Aucun commentaire:
Enregistrer un commentaire