[html-formfu] checkbox strangeness

Ronald J Kimball rkimball+formfu at pangeamedia.com
Wed Sep 17 15:21:59 BST 2008


Geoffrey D. Bennett wrote:
> On Mon, Sep 15, 2008 at 10:31:33AM -0400, Ronald J Kimball wrote:
>> Geoffrey D. Bennett wrote:
>>> On Mon, Sep 15, 2008 at 09:31:57AM -0400, Ronald J Kimball wrote:
>>>> HTML::FormFu handles this correctly.
>>> For a single form submission, maybe, but not for setting the "checked"
>>> attribute correctly in displayed forms.  I just tried the form you
>>> suggested above, and it only displays the checkboxes correctly if
>>> there is no more than one checkbox selected (if more than one was
>>> selected, they all end up unchecked).
> [...]
>> It works for me with HTML::FormFu::Element::Checkboxgroup.  I forgot to 
>> mention that detail.  :)
> 
> Riiight :-).  Does that mean we're back where we started -- that
> single checkboxes are booleans?  And if you want multiple checkboxes
> with the same name then you should be using Checkboxgroup?
> 

Okay, I tested it with individual Checkbox elements that have the same 
name and see the same behavior you did.  As you said, the code in 
Checkbox::prepare_attrs() assumes that there will be a single value. 
Maybe that should be changed: Checkbox could accept a list of values, to 
work with multiple checkboxes with the same name.

A Checkboxgroup works if all the checkboxes should be together in the 
form, but there could be cases where the user wants the checkboxes to be 
mixed in with other elements.

Ronald



More information about the HTML-FormFu mailing list