lundi 4 mars 2019

How to add an onchange listener to a checkbox on Yii2 to submit form when changed

I want to submit the search form whenever I check or uncheck the checkboxes. I've got the following code but can't make it work... it's quite simple I guess but can't get around it!

<?= $form->field($searchModel, 'pets_allowed')->checkbox(['options'=>['onchange'=>'"this.form.submit();}"']]); ?> 

Thanks in advance :)




Aucun commentaire:

Enregistrer un commentaire