[development] What should we do with checkboxes?

Chris Johnson chris at tinpixel.com
Mon Dec 26 02:58:15 UTC 2005


Karoly Negyesi wrote:

> Either we change #default_value structure or we change #value.
> 
> a) We could make #default_value an array of
> 
> something_that_has_the_information => 1
> 
> pairs. This would make it more complicated to build #default_value and
> it's looking strange.
> 
> b) we change #value instead to be a list of selected values, like in  
> multiselect. The code change in form.inc for this is minimal:
> 
> if ($form['type'] == 'checkboxes') {
>    $edit = array_keys(array_filter($edit));
> }

I think (b) is uglier and less efficient than (a).  (a) also makes more 
logical sense to my way of thinking.  I don't find it strange looking; it 
actually rather resembles how HTML works.

My 2 cents.

..chrisxj



More information about the development mailing list