On Nov 9, 2009, at 1:21 PM, Adam Grant wrote:
> I believe the behavior you are seeing is the correct behavior. If
> you submit the form without the checkbox being checked,
> you should see this in your params:
>
> {"interface => {:isTrusted => '0'}} #=> As
> determined from <input type="hidden"/>
>
> If you have the checkbox checked, then the <input type="checkbox"/>
> should take priority:
>
> {:interface => {:isTrusted => '1'}}
>
> Unlike normal text fields, checkboxes' values do not get submitted
> UNLESS they are checked, but hiddens always do, so its a bit of an
> HTML hack. This is mainly for submitting a default value though "0",
> so if its not needed, you can get rid of the hidden field. And I
> believe the behavior of Rails is to overwrite the params with the
> latest value for a certain key (as opposed to the first value it
> finds for "isTrusted").
>
> Hope that helps. I've always had issues with checkboxes. Finicky
> things they can be!
Actually, the value returned in params is the *name* attribute. The ID
is really supposed to be unique; Rails avoids this problem by
passing :id => nil to the hidden field. Edge hobo will do so as well,
in the next couple days - the change should be merged in shortly.
--Matt Jones
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en
-~----------~----~----~----~------~----~------~--~---