RE: [PHP] php processing name vs. id field
| From: | tedd | Date: | Fri, 02 Jul 2010 15:10:05 +0000 |
| Subject: | RE: [PHP] php processing name vs. id field | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-306636@lists.php.net to get a copy of this message | ||
At 8:49 AM -0400 7/2/10, Bob McConnell wrote:
These conditions sound like a bugs to me. I can't imagine any reason why different forms could have the same name or idBob: No offense, but duh! I can imagine, try this: The first form asks for the user's email address. The input statement has the attributes of "name" and "id" and both have values equal to "email", such as: <input type="text" id="email name="email"> You have a css rule that styles the email input statement via "id" as the browser gets it from the server and presents it to the user. You have a javascript routine that does a live-check of the validity of the email address while the user enters the data. You have a php script that processes the data using "name" after the submission of the form. All of these are using name and id attributes from an input tag AND there is NO restriction as to what values any of these attributes can hold nor is there any restriction on what you call them, nor does any of this happen at the same time or even in the same stage of action. The css is delivered from the server to the browser, the javascript routine is triggered by the user entering data via his browser, and the php script is run after the user clicks submit. All of these happen at different times. The second form (to fulfill your "different forms requirement) simply repeats the email value (i.e., value="<?php echo($email); ?>" and awaits the user to confirm. End of example -- and that's done routinely. ---------------
Each one must have a unique moniker, no matter which attribute you use.That's nonsense. Why would html require that php, javascript, and css use different values for different attributes? I don't think you've thought this out. ---------------
Even the simple validations I use will complain about your duplicates, as they should.Show me any validation that requires no duplicates in attribute naming convention. ---------------
Making them all unique also makes it much simpler to use tools like Selenium or Silk Test to automate the testing process.Simpler for whom?
Looking at the HTML 4.01 references given earlier in this thread, I see that id is now a core attribute, i.e. it is available for all but a handful of tags, while name is only available for the tags where it is explicitly included. So it still appears to me that id is the preferred attribute, as it is more generally available. Bob McConnellPopularity of attributes is not an indicator of which is correct to use for all languages. It is only an indicator that the "id" attribute is more common, which has no point. The net is a collection of efforts and languages -- while you may want to reduce input statement (and other tags) attributes from allowing both "name" and "id" to just "id" the practice would be devastation on a global scale. Please rethink. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com