[html-formfu] checkbox strangeness

Ronald J Kimball rkimball+formfu at pangeamedia.com
Mon Sep 15 14:31:57 BST 2008


Geoffrey D. Bennett wrote:
> On Mon, Aug 25, 2008 at 09:35:18AM +0100, Carl Franks wrote:
>> The reason that's not a default, is that checkboxes aren't always a
>> simple boolean [...]
> 
> Can you explain this statement?  The only non-boolean checkboxes I
> could think of would be greyed-out disabled ones (but then you'd be
> ignoring the value, which would still be a boolean), or a checkbox
> that represents a collection of items some of which are in a "true"
> state and others in a "false" state, and the checkbox is therefore in
> a "mixed" state (although, I don't think HTML supports this).

It is common to have a group of checkboxes that share the same name, 
each with a different value.  For example:

<input type="checkbox" name="interest" value="books">
<input type="checkbox" name="interest" value="movies">
<input type="checkbox" name="interest" value="cooking">
<input type="checkbox" name="interest" value="sports">

If the checkboxes for books and cooking are checked, then the HTTP 
request will include &interest=books&interest=cooking.

HTML::FormFu handles this correctly.

Ronald





More information about the HTML-FormFu mailing list