Created
August 16, 2008 22:48
-
-
Save bryansray/5762 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
checkbox_control :is_searchable, :label => "Allow other #{SITE_NAME} members to search for me and view me on the members page?" | |
# Generates this: | |
<input type="checkbox" id="user_is_searchable" value="1" name="user[is_searchable]" class="checkbox" checked="checked"/> | |
<input type="hidden" value="0" name="user[is_searchable]" class="hidden"/> | |
<label for="user_is_searchable">Send me weekly motivator reports?</label> | |
# When this is submitted to the controller I get: | |
{ "user" => { "is_searchable" => "0" } } | |
# Even if the checkbox is checked? | |
# I can solve this by simply reversing the order of the hidden checkbox field. Like so: | |
<input type="hidden" value="0" name="user[is_searchable]" class="hidden"/> | |
<input type="checkbox" id="user_is_searchable" value="1" name="user[is_searchable]" class="checkbox" checked="checked"/> | |
<label for="user_is_searchable">Send me weekly motivator reports?</label> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment