Re: Quickform element ids
| From: | John Vincent | Date: | Fri, 05 Sep 2003 19:04:34 +0000 |
| Subject: | Re: Quickform element ids | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7606@lists.php.net to get a copy of this message | ||
See below.
Alexey Borzov wrote:
Hi! John Vincent wrote:Why are form elements not having ids assigned based on the element name?Because ids should be unique, while names can be duplicate. Radios and checkboxes have autogenerated ids in QuickForm (to be able to use <label>'s with them) and you can add an id attribute to any other element manually. Good point but see below.
$form->addElement('text', 'txtUsername', 'Enter your username'); Now previously I remember that the way QuickForm creates both a name AND an id tag for the <form element> based on the name you assign to the form when you create it. My understanding was that this, while not fully valid XHTML, is needed for internal quickform processing. Is this case the same for other form elements? I think what I'm really struggling for here is terminology. Take my text element example above. Each passed variable is probably known by a specific name to the developers but I'm not sure what that is. I call it ('element type', 'element name', element label') so when I refer to using the "element name" as the ID, does quickform allow multiple elements to share that same name? I can understand that it might not work with multiple forms on one page but that's a unique situation. Thanks either way, JohnI remember discussion on having a name and id for the form element as a whole and it not validating but what was the reasoning for that with form elements? I'm only seeing this on text elements, btw.Don't quite get you here. Actually this ties into the first part. Let's say I create an element like so: