I have just been using the same control name, counties[] for several SELECT inputs so that counties in England, Scotland, Wales and Ireland in each are are all passed as values for the same parameter to the PHP script handling it.
HTML Validator gives a warning "[119] The control name "counties_covered[]" has already been used in this form and should not be used in this "select" tag." for this.
The technique appears to work OK - has anyone else tried this and encountered problems?
If not, should the should the warning given continue with something like "unless this was intended"?
Edit:
I suppose it would be a problem if Javascript were involved.
Duplicate control names for SELECT tag?
-
- Rank II - Novice
- Posts: 40
- Joined: Tue Feb 01, 2005 5:47 am
- Location: Newcastle under Lyme, UK
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: Duplicate control names for SELECT tag?
Hello,
Thanks for reporting this.
Perhaps the best solution is to just ignore this "issue" if the control name ends in "[]"? Or change the message to a regular (non-warning/non-error) message? Which do you think would be better (more useful to developers)?
UPDATE: The message should now read like this:
[119] The control name "counties_covered[]" for this "select" tag has already been used in this form. Ensure that this is intended.
Thanks for reporting this.
Perhaps the best solution is to just ignore this "issue" if the control name ends in "[]"? Or change the message to a regular (non-warning/non-error) message? Which do you think would be better (more useful to developers)?
UPDATE: The message should now read like this:
[119] The control name "counties_covered[]" for this "select" tag has already been used in this form. Ensure that this is intended.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 40
- Joined: Tue Feb 01, 2005 5:47 am
- Location: Newcastle under Lyme, UK
Re: Duplicate control names for SELECT tag?
It probably is better as just an informative message rather than a warning, but I'd stand corrected if there is good reason it shouldn't be done.
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: Duplicate control names for SELECT tag?
Do you mean that when the name ends in "[]" to indicate an array, that the message should be an informational message instead of a warning? I could certainly do this, but I'm thinking that suppressing the message entirely (when the name ends in "[]") might be the better way to go. Do you see any issues with just suppressing the message entirely (when the name ends in "[]")? I think that is what I will do unless there is a good reason to justify an informational message instead of a total message suppression.
I don't think there is any reason using "[]" for arrays and using the same array name more than once shouldn't be done where it is wanted or needed, and used properly of course.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial
-
- Rank II - Novice
- Posts: 40
- Joined: Tue Feb 01, 2005 5:47 am
- Location: Newcastle under Lyme, UK
Re: Duplicate control names for SELECT tag?
I think you're right, there's no need for a message at all if it is an array that is being passed unless there is another reason that the user should be alerted, such as the control name being used by Javascript (which I'm not very well up on).
-
- Site Admin
- Posts: 3785
- Joined: Sat Dec 11, 2004 9:23 am
- Location: Near Dallas, TX
Re: Duplicate control names for SELECT tag?
Great. That's what I'll do then for the next update. I don't want to alert users with warnings for issues that are very likely to be as intended.
Albert Wiersch, CSS HTML Validator Developer • Download CSS HTML Validator FREE Trial