Sunday, September 11, 2011

[Rails] check_box not passing 0 when unchecked?

Code:
<%= check_box("schedule_report", "active_#{id}",
options={:id=>"schedule_report_#{id}_active", :checked
=>schedule_report.active }, 1, 0) %>

Rendered output:
<input type="hidden" value="0" name="schedule_report[active_20]">
<input id="schedule_report_20_active" type="checkbox" value="1"
name="schedule_report[active_20]" checked="checked">

<input type="hidden" value="0" name="schedule_report[active_17]">
<input id="schedule_report_17_active" type="checkbox" value="1"
name="schedule_report[active_17]">
.......

Problem:
The value of "1" is always passed, even if the box is UNCHECKED.
Please help!

Thanks!

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate