- From: Ric Hardacre <ric@hardacre.org>
- Date: Tue, 25 Jul 2006 08:48:34 +0100
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Michel Fortin wrote: > Le 24 juil. 2006 ? 11:59, Ric Hardacre a ?crit : > >> When using checkboxes in forms i find myself doing this >> >> <input type="checkbox" name="foo" value="true"> >> <input type="hidden" name="foo" value="false"> > > I'm doing the same right now. I have a list of checkbox which can be > either on or off for each of my elements, and I can't rely on the input > being absent meaning it is off because the list is paginated and may not > show all elements at once. That hidden input trick is quite handy. > > What about adding a "value-unchecked" attribute instead: > > <input type="checkbox" name="foo1" > value="true" value-unchecked="false"> > > In the absence of a "value-unchecked" attribute, an unchecked checkbox > sends no input, just like the checkbox we have today. Yes, something like that would do it. I realised that you can just use two radio buttons in a group to achieve the same affect, or a two-choice select but the checkbox is in many instances (apart from sometimes say, agreeing with terms and conditions statements) the logical field to use. from the current spec: " For checkbox and radio form controls, the value attribute defaults to the literal string on, so that if the value content attribute is not specified then the value DOM attribute (and the value used for submission when the controls are checked) is "on". For other controls the default is the empty string. " so we are already providing exceptional rules for the checkbox element. Ric Hardacre http://www.cyclomedia.co.uk/ -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFExczSdf0h6ZthGgIRAtROAKDa/XW2sIrg/gkJMOtkg7/aA55B/QCfVA2f PiA6F4lT98ktoS4BHaAvo2A= =qPs5 -----END PGP SIGNATURE-----
Received on Tuesday, 25 July 2006 00:48:34 UTC