I just noticed that when a user attempts to remove a check on a form it's actually not maintaining the state.
My form looks like the following (with Slim)
=f.tb_label :marketing_systems
=hidden_field_tag 'course_group[marketing_systems][]', nil
.col-sm-10
.multi-select
table
tbody
-MarketingSystem.ordered.each do |system|
-input_name = "course_group_marketing_system_#{system.id}"
tr
td = check_box_tag 'course_group[marketing_system_ids][]',
system.id,
@course_group.marketing_systems.include?(system),
id: input_name
I thought with setting a nil on the hidden tag field that it would push that when empty. However it's not. Do I have something set up wrong with the check_box_tag that's not passing empty?
I've tried putting the arguments in parenthesis and putting, checked = false on the check_box_tag but that didn't work. If I add in value = 0 then it's throwing an issue with too many arguments. I'm just looking to update the data with removing the system.id if it's been unchecked.
Aucun commentaire:
Enregistrer un commentaire