Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

add in the hidden text field for boolean fields #91

Merged
merged 1 commit into from

2 participants

@danklassen

This adds in the missing hidden text field for checkbox fields allowing them to be unchecked

fixes issue #90

@sodabrew sodabrew merged commit 5a26414 into mjbellantoni:master
@sodabrew
Collaborator

This looks reasonable, thanks for the contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 16, 2014
  1. @danklassen
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 0 deletions.
  1. +5 −0 lib/formtastic-bootstrap/inputs/boolean_input.rb
View
5 lib/formtastic-bootstrap/inputs/boolean_input.rb
@@ -6,11 +6,16 @@ class BooleanInput < Formtastic::Inputs::BooleanInput
def to_html
checkbox_wrapping do
+ hidden_field_html <<
"".html_safe <<
[label_with_nested_checkbox, hint_html].join("\n").html_safe
end
end
+ def hidden_field_html
+ template.hidden_field_tag(input_html_options[:name], unchecked_value, :id => nil, :disabled => input_html_options[:disabled] )
+ end
+
def label_with_nested_checkbox
builder.label(
method,
Something went wrong with that request. Please try again.