Skip to content

Commit

Permalink
Changes to include hidden field in collection_check_box
Browse files Browse the repository at this point in the history
  • Loading branch information
shivam091 committed May 20, 2023
1 parent 6bb55dc commit e1f165e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/rails_bootstrap_form/inputs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,12 @@ def collection_check_boxes(attribute, collection, value_method, text_method, opt
inputs << check_box(attribute, input_options, input_value, nil)
end

if options.delete(:include_hidden) { true }
inputs.prepend hidden_field(attribute, value: "", multiple: true)
end

field_wrapper_builder(attribute, options, html_options) do
concat(tag.div(control_specific_class(:collection_check_boxes)) do
concat(tag.div(class: control_specific_class(:collection_check_boxes)) do
concat(inputs)
end)
end
Expand All @@ -209,7 +213,7 @@ def collection_radio_buttons(attribute, collection, value_method, text_method, o
end

field_wrapper_builder(attribute, options, html_options) do
concat(tag.div(control_specific_class(:collection_radio_buttons)) do
concat(tag.div(class: control_specific_class(:collection_radio_buttons)) do
concat(inputs)
end)
end
Expand Down

0 comments on commit e1f165e

Please sign in to comment.