Passed to your browser as evidenced by the above renderings (which
would be correct), or as in, the form always returns a 1? Big
difference. In the latter case, we'd need to know what browser (and
possibly OS), unless you mean all. Could be just a browser bug.
I've been wracking my brains to see what's wrong with the HTML
(especially since it's been generated with the check_box() helper).
Maybe I'm missing something obvious... ?
I don't think you're missing anything -- I've tested Joan's code in Safari and it works as expected (you find '0' in the params when you uncheck a box).
I do seem to remember some weirdness with Rails' checkboxes/hidden fields pairs and Firefox, to do with the way it restores form state when you go back to (or even reload) a form. However, I couldn't replicate the problem in Firefox 6.0.1, so maybe it's an old bug or maybe I'm misremembering things.
Yes, the test was done in firefox 6.0.2 and the params were passed
through an ajax link by checking checkbox value (jquery). Can't paste
the code here coz I can't access the source now.
Ah, ajax may be the key. How are you serialising the form inputs? If
you're always submitting the checkbox's value then it will indeed only
ever submit '1'. You'd need to select the appropriate value based on
whether the checkbox was checked.
Ah, ajax may be the key. How are you serialising the form inputs? If
you're always submitting the checkbox's value then it will indeed only
ever submit '1'. You'd need to select the appropriate value based on
whether the checkbox was checked.
Fred
Hi Fred,
Yes, you are right, the ajax code passing checkbox's value is the root
cause.