dimanche 28 janvier 2018

ruby on rails multiple checkbox params

I have an application in which multiple checkboxes to be selected, so how to provide the name as an array in checkbox tag so that I can retrieve it in my params in controller. I am actually quite confused in my checkbox params, especially for multiple checkboxes. can I give it any random name in checkbox name = "any name " so that i can access it in my params in controller Please heed my query, I can't even find an appropriate article for the same

Thanks in advance

I named it as hi[] array, 'hi' random word or should I have to follow some convention

<input type="checkbox" name= "hi[]" value="" class="form-select form-control" id="clients"
                           onchange="this.value=this.checked;"  style="display: inline-block;width: 20px;" />




Aucun commentaire:

Enregistrer un commentaire