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!

Regards,
Adam

On Fri, Nov 6, 2009 at 6:08 AM, LadyBug <[email protected]> wrote:

>
> Which reminds me of this piece of basic <form> and <field-list
> fields="..., isTrusted" > generated HTML:
>
> <input id="interface_isTrusted" name="interface[isTrusted]"
> type="hidden" value="0" />
> <input class="isTrusted-tag boolean interface-isTrusted"
> id="interface_isTrusted" name="interface[isTrusted]" type="checkbox"
> value="1" />
>
> Shouldn't the id attributes be different here (or the hidden one
> removed)?
> I think non-Hobo Rails doesn't generate same id attributes to these
> checkbox items.
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to