Re: Quickform element ids

From: Date: Fri, 05 Sep 2003 19:25:12 +0000
Subject: Re: Quickform element ids
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7608@lists.php.net to get a copy of this message
Hi! John Vincent wrote:
Actually this ties into the first part. Let's say I create an element like so: $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.
I still don't get your problem. If the question is "Why QuickForm does not use element names as their 'id' attributes" then the answer is "Names can be not unique, while 'id' attributes should". That implies the possibility of duplicate element names within QuickForm. Consult the QuickForm_example.php file for a demo (two elements sharing 'iradYesNo' name). This has nothing to do with 'name'/'id' attribute of <form> tag itself.

« previous php.pear.general (#7608) next »