mercredi 4 novembre 2015

Rails check_box_tag - get all the values selected

So I have multiple checkboxes on my page. I collect all of them like shown in the code below. I would like to access the values of the array before passing it on to the controller

= check_box_tag "names[]", ob.name, false, class: 'cbx'

Logs:

Processing by SomeController#create as HTML Parameters: {"utf8"=>"✓", "names"=>["ron", "jacob"], "commit"=>"NameButton"}

Ok. So i would like to access all values in my haml files. Is there a way before i submit my form, I can access which checkboxes are selected.

Rails version - 3.2.17




Aucun commentaire:

Enregistrer un commentaire