checkbox in merb edge

20 views
Skip to first unread message

MarkMT

unread,
Oct 18, 2009, 8:54:05 PM10/18/09
to merb
I'm seeing some behavior I don't understand with checkbox input in
merb 1.1.

My erb looks like this -

---
<%= form_for @event, :action => action do %>
<%= check_box :local, :on => 'true', :off => 'false' %>
<% end =%>
---

I have 1.0.11 running fine on my production machine and have recently
installed edge on my development machine. The html generated in the
two cases is almost identical. Both generate a hidden field preceding
the html checkbox. The hidden input and the checkbox both have
name="event[local]".

The only difference between the two versions seems to be that with
1.0.11 the element id on the hidden field has square brackets but not
in 1.1 - I believe this reflects this patch -
http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-html-id-attributes/
- and afaik this shouldn't cause any problems.

The weirdness is that with edge, when the checkbox is checked, the
request that arrives in the controller has the input set to 'false',
even though firebug shows that the form generates an input with value
'true' as it should be (subsequent to a 'false' value generated by the
hidden field). I see the same thing with 5 different checkboxes in the
same form.

Anyone else seen this?

MarkMT

unread,
Oct 18, 2009, 9:48:19 PM10/18/09
to merb
Another clue about this...

The form that has the checkbox in it also has a
<%= file_field :attachment %>
input to handle a file upload. When I remove this file upload input
from the form, the checkbox data arrives correctly. I have no idea
why.

Appreciate any insights.

Pavel Kunc

unread,
Oct 19, 2009, 6:01:34 AM10/19/09
to merb
Hi Mark,

could you please file the Ticket for this one. It's really strange and
we must add specs and fix this corner case. Thanks.

Pavel
> >http://sick.snusnu.info/2009/03/25/merb-helpers-should-produce-valid-...

MarkMT

unread,
Oct 19, 2009, 10:11:41 AM10/19/09
to merb
Ticket filed, including link to a recent patch that seems to be
causing the problem.

https://merb.lighthouseapp.com/projects/7433-merb/tickets/1304-multipart-input-parsing-produces-wrong-checkbox-input

Mark.
Reply all
Reply to author
Forward
0 new messages