473,378 Members | 1,084 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

XHTML: <select> tag and numeric name attribute

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
9 6028
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ang Talunin | last post by:
Hey, I wondering if it's possible to retrieve all the <option>-fields from a <select> when posting a <form> to a php file Example: I've got a form like this: <form action = phpfile.php...
3
by: Darren | last post by:
Please Help Me!! I've created a typical <form> and a <select> element. The options are created dynamically from my access database (using asp). There are about 70 options, and when you click...
3
by: gekoblu | last post by:
Hi!, I want to fix via javascript the combo width to a fix value. I'd like to implement a kind of ALT / TITLE function to show the entire option when the text is longer than the combo width......
6
by: Omar | last post by:
Hi, In a JSP I have the next: .... codigo = "<select name='" + nombre + "'>\n<option selected value='default'>Escoge</option><option value='todos'>Todos</option>"; if (miRS != null) while...
6
by: Bonge Boo! | last post by:
This has got to be obvious, but I can't make it work. I have a form called with 3 pull down menus. They are linked to a database which generates the values for the <SELECT? Pull-downs. Lets...
6
by: joseph.lindley | last post by:
Forgive me for I am a bit of a web-dev novice - but I'm not doing too bad. I'm currently working with a bit of javascript to dynamically add <option>s into a select box. My code currently works...
1
by: frey | last post by:
i tried to create a dropdown menu and use the option as a control to change content inside another text area the code is like this: <select name="xxxx"><option onclick="changeunitprice(29.87)"...
5
by: Alan M Dunsmuir | last post by:
I have a Form with a <SELECTtab, its <OPTIONtabs generated by records in a database table using PHP5 and a 'SELECT' query. The values displayed are chosen to be recognisable to the users (they...
1
by: akoymakoy | last post by:
Good Day I have these line of codes in my javascript ...... if (selObj.type == 'text' ) { parentObj = document.getElementById('destinationCity').parentNode; ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.