mercredi 24 avril 2019

Symfony 3 - JS- How to gray out a set of checkboxes at the click of a radio button?

in a twig view, which allows me to do statistics I display several things:

A group radio button that allows me to select either "Option A", "Option B", "Both".

And a set of checkboxes referring to user types. They will be displayed through a database query.

Like this :

<legend>Type : Sélectionner tout <input type="checkbox" id="selectAll" value="selectAll" class="selectAllCheckboxes"></legend>
                    

I already have a function in javascript allowing me to select all and deselect at once.

Now what I would like to do is this:

enter image description here

If I check "External", then I want that in the list of user types, the type "1st degree" is automatically checked, and that the rest can not be.

And conversely :

enter image description here

If "CAS" is checked, then all other types have the option to be checked, except the "1st degree" type.

But since I know absolutely nothing about javascript, and I display my user types through a database and I do not write them myself, I do not see how I take it. Thanks for your help !




Aucun commentaire:

Enregistrer un commentaire