W3C home > Mailing lists > Public > whatwg@whatwg.org > July 2006

[whatwg] non-checked checkbox posting success?

From: Ric Hardacre <whatwg@cycloid.f9.co.uk>
Date: Mon, 24 Jul 2006 16:59:07 +0100
Message-ID: <44C4EE4B.6080602@cycloid.f9.co.uk>
When using checkboxes in forms i find myself doing this

<input type="checkbox" name="foo" value="true">
<input type="hidden" name="foo" value="false">

and retrieving the value from the posted form data a bit like this

if( checkbox.value == "false" )then
	bSomeBool = false;
	bSomeBool = true;

in the "else" case above checkbox.value will equal something along the
lines of "true, false". Does anybody think it would be good to allow a
checkbox (and similar controls) to be used in a proper toggle sense?


<input type="checkbox" name="foo" toggle="true,false" value="on">

where on/off (or setting checked) would toggle the true/false, and any
values can be used in the toggle attribute:

<label>Click here if you have a dog <input ... toggle = "Dog owner,No
dogs" value="off" ... ></label>

I'm only attempting to provoke a discussion here, so dont take my code
and attributes too seriously :-)

Ric Hardacre
Received on Monday, 24 July 2006 08:59:07 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:58:47 UTC