mercredi 27 juillet 2016

How to attach an input checkbox to a form (button_to)

I have two "button_to" tags (so they are forms)

= button_to("Validate", validate_contracts_path , {method: :patch, class: "bulk-selection"})
= button_to("Sign", sign_contracts_path , {method: :patch, class: "bulk-selection"})

and I have a checkbox collection below in a table, each checkbox represents a row, they are to perform bulk actions and the checkboxes are not included in the form.

td = check_box_tag "selected_records[#{record.id}]"

I would like to know if it is possible to attach the checkboxes when one of the buttons is clicked.

The more rails way the better, but it would be great too if it is achieve with JS

Thanks




Aucun commentaire:

Enregistrer un commentaire