Re: Using 'name=' in Form elements - Why not?

Ed Jay wrote:

> My pages won't validate, because I use the 'name' attribute in <form>.

The 'name' attribute *is* allowed on 'form' elements in HTML. However, in
XHTML 1.0, there seems to be an error in the DTD.

The XHTML 1.0 Recommendation, Second Edition, section 4.10 states:

 | HTML 4 defined the name attribute for the elements a, applet, 
 | form, frame, iframe, img, and map. [...] Note that in XHTML 1.0,
 | the name attribute of these elements is formally deprecated.

And in Appendix C.8:

 | Note that XHTML 1.0 has deprecated the name attribute of the a,
 | applet, form, frame, iframe, img, and map elements.
 
However, the Transitional DTD has:

 | <!ATTLIST form
 |   %attrs;
 |   action      %URI;          #REQUIRED
 |   method      (get|post)     "get"
 |   enctype     %ContentType;  "application/x-www-form-urlencoded"
 |   onsubmit    %Script;       #IMPLIED
 |   onreset     %Script;       #IMPLIED
 |   accept      %ContentTypes; #IMPLIED
 |   accept-charset %Charsets;  #IMPLIED
 |   >

Whereas the First Edition Transitional DTD had:

 | <!ATTLIST form
 |   %attrs;
 |   action      %URI;          #REQUIRED
 |   method      (get|post)     "get"
 |   name        NMTOKEN        #IMPLIED
 |   enctype     %ContentType;  "application/x-www-form-urlencoded"
 |   onsubmit    %Script;       #IMPLIED
 |   onreset     %Script;       #IMPLIED
 |   accept      %ContentTypes; #IMPLIED
 |   accept-charset %Charsets;  #IMPLIED
 |   target      %FrameTarget;  #IMPLIED
 |   >

A bunch of 'target' attributes also seem to have disappeared from
Transitional between First and Second Editions. 

I'm CCing the W3C's HTML Editor in this message. Perhaps some clarification
is needed in the errata?

That said, if you're using XHTML, you should probably be moving away from
deprecated features like the 'name' attribute. Use 'id' instead.

-- 
Toby A Inkster BSc (Hons) ARCS
Contact Me  ~ http://tobyinkster.co.uk/contact

Received on Wednesday, 16 August 2006 15:45:17 UTC