lundi 20 mars 2017

Is it possible not to send params when checkbox is unchecked with remote true?

I have a check_box_tag, that is set to remote: true. When I click on a checkbox, it sends params to the controller, but when I click on it again (make it unchecked), the params are sent to controller one more time. This is the code for the checkbox:

<%= check_box_tag '', '', false, data: { remote: true, url: url_for(action: 'filters', category_id: category.id), method: :get }, class: 'filter-checkbox' %>

What is the way of preventing sending params when the checkbox is set to unchecked? Thanks.




Aucun commentaire:

Enregistrer un commentaire