Re: HTML_QuickForm, advcheckbox, setChecked()

From: Date: Mon, 19 Apr 2004 11:37:33 +0000
Subject: Re: HTML_QuickForm, advcheckbox, setChecked()
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28007@lists.php.net to get a copy of this message
On Apr 18, 2004, at 10:09 PM, Daniel Convissor wrote:
I'm not certain that is the case. Each element must have a unique ID attribute, but multiple elements are allowed to have identical names (e.g., a series of radio buttons will use the same name).
Like you said "radio buttons" have the same name, because you can only select one. Hence, what comes back is unique. Similarly, what comes back from a checkbox must be unique as well. Regarding check boxes, it all depends on what one means by "must." Will the HTML render if you have two elements with the same name? Yes. But what matters is "does the data that comes back make any sense?" No. Aidan is right. Each checkbox element should have a distinct name.
I agree; each checkbox element must have a unique name -- but we're not talking about multiple checkboxes, we're talking about a "hidden" and a a "checkbox". A checkbox element and a hidden element may share a name, may they not? What comes back is unique: the hidden value if the box is not checked, and the checkbox value if it is checked. Does it make sense? Well, it seems so: only one value comes back, as HTTP does not post the checkbox value if not checked, and overrides the hidden value if it is checked. Try it, you'll see. Maybe it's implementation-specific, but I don't think so. Anyway, we seem to have gotten very far away from PHP here; maybe this would be better off the list. I'm willing to continue the discussion if everyone else has not gotten tired of it yet. :-) -- Paul M. Jones pmjones@ciaweb.net Savant: the simple alternative to Smarty. http://phpsavant.com/

« previous php.pear.dev (#28007) next »