By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,034 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

XHTML: <select> tag and numeric name attribute

P: n/a
Hi all,
is it legal to use a fully-numeric string as "name" attribute for the
<select> tag in the XHTML standard?

E.g.:

<form action="action.php" method="get">
<select name="12345">
<option value="1">test</option>
</select>
</form>

Is it okay to use "12345" as the name of the tag?

Is it valid also for all the other XHTML tags?

Thanks.
Jul 20 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
aragon wrote:
is it legal to use a fully-numeric string as "name" attribute for the
<select> tag in the XHTML standard?
Why not just look it up?

The answer can be found here:
http://www.w3.org/TR/xhtml1/dtds.htm...TML-1.0-Strict

It says that the name for an <input> element can be any CDATA: that is
absolutely any characters.
Is it valid also for all the other XHTML tags?


Yes. For many tags (<frame>, <iframe>, <object>, <applet>, <img>, <a> and
maybe some others) the rules are somewhat stricter than for <input>: they
use NMTOKEN data instead of CDATA, but NMTOKENs still allow for all-number
names.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?page=132

Jul 20 '05 #2

P: n/a
On Mon, 16 Feb 2004 19:30:22 +0100, aragon <me@privacy.net> declared in
comp.infosystems.www.authoring.html,alt.html:
is it legal to use a fully-numeric string as "name" attribute for the
<select> tag in the XHTML standard?
The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10

If you still want to use it, the same rules apply as in HTML. On a
select element the name attribute is CDATA, so yes, all numbers is fine.
http://www.w3.org/TR/html4/interact/...ef-name-SELECT

Is it valid also for all the other XHTML tags?


Do you mean the name attribute on other elements? Or do you mean other
attributes (e.g. id)?

The name element is _usually_ CDATA. The only exception that I can find
offhand is the meta element, where it is ID. This means that it must
start with a letter.

The id attribute must always start with a letter.

Other attributes vary. Check the specs for more information.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #3

P: n/a
Mark Parnell wrote:
The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10


I should be using the id attribute instead, right?

Does all browsers support it just like the name attribute?

I will save the form fields values into a database table and I have to
make sure the form will work fine with all browsers.

BTW, the name attribute for the select tag still validates as XHTML 1.0
Transitional with the W3C online validator.

Thanks.
Jul 20 '05 #4

P: n/a
On Mon, 16 Feb 2004 23:36:24 +0100, aragon <me@privacy.net> declared in
comp.infosystems.www.authoring.html:
I should be using the id attribute instead, right?
Yes.
Does all browsers support it just like the name attribute?
Except NS4, AFAIK. But that is hardly worth worrying about any more.

I will save the form fields values into a database table and I have to
make sure the form will work fine with all browsers.
If it is only for your form processing, AFAIK it shouldn't make a
difference what browser is used, as long as it sends the right
information. Someone else may be able to give you more information
there.

BTW, the name attribute for the select tag still validates as XHTML 1.0
Transitional with the W3C online validator.
That's because Transitional allows you to use the deprecated stuff,
including <font>. That doesn't mean you should.
Thanks.


No worries.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #5

P: n/a
On Tue, 17 Feb 2004 08:50:27 +1100, Mark Parnell
<we*******@clarkecomputers.com.au> wrote:
On Mon, 16 Feb 2004 19:30:22 +0100, aragon <me@privacy.net> declared in
comp.infosystems.www.authoring.html,alt.html:
is it legal to use a fully-numeric string as "name" attribute for the
<select> tag in the XHTML standard?


The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10


Pardon? Try reading that section again:

"...the name attribute for the elements a, applet, form, frame,
iframe, img, and map...is formally deprecated, and will be removed
in a subsequent version of XHTML."

Where in that list of elements is SELECT, or any form element for that
matter, mentioned[1]? Also, can you please explain why the name attribute
is listed for SELECT in the strict DTD for XHTML if it's deprecated?

For the use of fragment identifiers and (I think) scripting, the use of
name should be avoided. However it is still perfectly valid with form
controls as that name is used during submission.

[snip]
Is it valid also for all the other XHTML tags?


To the OP: name is only valid for form controls or where otherwise
presented in the Strict XHTML DTD[2]. In all other elements, it has been
deprecated.

[snip]

Mike
[1] Be aware that the entire second paragraph in that quote is missing as
it only relates to fragment identifiers, which has no bearing on the OP's
question. In the third paragraph, where my quote resumes, the text, "the
name attribute of these elements", refers to the elements listed in the
first paragraph.

[2] A mark-up version of the Strict XHTML DTD:

http://www.w3.org/TR/xhtml1/dtds.htm...TML-1.0-Strict

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #6

P: n/a
On Mon, 16 Feb 2004 23:36:24 +0100, aragon <me@privacy.net> wrote:
Mark Parnell wrote:
The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10
I should be using the id attribute instead, right?


If you are using the name attribute to label form controls for submission,
then no - name is valid. If you are using it for any other purpose, then
yes - use id.
Does all browsers support it just like the name attribute?


In what context (how are you using name)?

[snip]

Mike

--
Michael Winter
M.******@blueyonder.co.invalid (replace ".invalid" with ".uk" to reply)
Jul 20 '05 #7

P: n/a
On Mon, 16 Feb 2004 22:56:57 GMT, Michael Winter
<M.******@blueyonder.co.invalid> declared in
comp.infosystems.www.authoring.html:
On Tue, 17 Feb 2004 08:50:27 +1100, Mark Parnell
<we*******@clarkecomputers.com.au> wrote:

The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10


Pardon? Try reading that section again:


Oops. I didn't read that very carefully, did I?

My apologies (especially to the OP).

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #8

P: n/a
In article <om****************************@40tude.net>,
Mark Parnell <we*******@clarkecomputers.com.au> writes:
The name attribute is deprecated in XHTML.
http://www.w3.org/TR/xhtml1/#h-4.10


Nonsense. The name attribute is required in any Form control that
needs to be identified by the server.

--
Nick Kew
Jul 20 '05 #9

P: n/a
On Mon, 16 Feb 2004 23:32:45 +0000, ni**@hugin.webthing.com (Nick Kew)
declared in comp.infosystems.www.authoring.html:
Nonsense. The name attribute is required in any Form control that
needs to be identified by the server.


I know. See my reply to Michael.

--
Mark Parnell
http://www.clarkecomputers.com.au
Jul 20 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.