Is it just me, or is this helper a little broken? I see the
description. It took me a while to figure out exactly what it was
doing (ie: why the heck it added a hidden field) and then I got to
wondering what the heck it was doing.

Slight recap. Per the documents:
---
formCheckbox($name, $value, $attribs, $options): Creates an <input
type="checkbox" /> element. The $options param is an array where the
first value is the "checked" value, and the second is the "unchecked"
value (the defaults are '1' and '0'). If $value matches the "checked"
value, the box will be checked for you.
----

That's confusing in itself. Is my "$options" an array of already
checked values? What's with this checked and unchecked value? Why do I
care about unchecked values? Checkboxes are all or nothing options.
Why do I care about the nothing value?

Then I look at the example:
----
  <p><label>Would you like to opt in?
        <?php echo $this->formCheckbox('opt_in', 'yes', null,
array('yes', 'no')) ?>
    </label></p>
---

Which produces:
----
    <p><label>Would you like to opt in?
        <input type="hidden" name="opt_in" value="no" />
        <input type="checkbox" name="opt_in" value="yes" checked="checked" />
    </label></p>
----

Then I got to wondering, who the heck designed this? For starters,
that should be a radio button question, not checkbox. Or you code to
properly check for "opt_in"; if it doesn't exist (or empty), they
didn't check the box.

The issue comes down to making lists. Checkboxes are for zero or more
answers in a list. Radio buttons are used for 1 required answer among
a list.

It seems to be this checkbox helper is completely broken. Not only
does it not work well for lists, it completely breaks when you try to
use it for a list. When you have a list of these checkboxes, everyone
attempts to value itself the same (based on name). None of them use []
to signify array input and, to top it off, if you put [] in the name,
it puts it in the ID value, which is invalid.

Now, my question to the devs, is this being updated? Fixed? Righted?
In its current incarnation, I feel its very broken and goes against
the very spec checkbox is suppose to be used form.

Or am I just smoking crack and I completely missed something here?

-- 
Philip
[EMAIL PROTECTED]
http://www.gpcentre.net/

Reply via email to