I have group of check boxes and i need when checkboxes selected or deselected then local variable 'address' containing values of checkboxen but in my format. Sample:
http://localhost/?param=1&cb[gr1]=vl1-vl3&cb[gr2]=vl1&cb[gr3]=vl1-vl2-vl3
If i select Group 1 - vl1 and vl3 Group 2 - vl1 Group 3 - vl1 and vl2 and vl3
http://localhost/?param=1
&cb[gr1]=vl1-vl3
&cb[gr2]=vl1
&cb[gr3]=vl1-vl2-vl3
How to make such a miracle in Java script?
And this source of html
https://jsfiddle.net/3vqr1ksy/
<form action="form.php" method="post">
<fieldset>
<legend>Group 1</legend>
<input type="checkbox" name="gr1[]" value="vl1"/>value 1<br/>
<input type="checkbox" name="gr1[]" value="vl2"/>value 2<br/>
<input type="checkbox" name="gr1[]" value="vl3"/>value 3<br/>
</fieldset>
<fieldset>
<legend>Group 2</legend>
<input type="checkbox" name="gr2[]" value="vl1"/>value 1<br/>
<input type="checkbox" name="gr2[]" value="vl2"/>value 2<br/>
</fieldset>
<fieldset>
<legend>Group 3</legend>
<input type="checkbox" name="gr3[]" value="vl1"/>value 1<br/>
<input type="checkbox" name="gr3[]" value="vl2"/>value 2<br/>
<input type="checkbox" name="gr3[]" value="vl3"/>value 3<br/>
</fieldset>
</form>
Aucun commentaire:
Enregistrer un commentaire