On Thu, 2010-07-01 at 10:19 -0400, Paul M Foster wrote:

> On Thu, Jul 01, 2010 at 03:40:56PM +0200, Peter Lind wrote:
> <snip>
> > Apart from that, html5 is not going to do away with the name
> > attribute. And name is in xhtml1 and html4.01 and there's no mention
> > of it being obsolete, deprecated or in any other fashion on the way
> > out.
> > 
> > As far as reference: the source.
> > http://www.w3.org/TR/xhtml1/dtds.html#a_dtd_XHTML-1.0-Strict very
> > clearly specifies that name is still a very valid attribute.
> > http://www.w3.org/TR/html401/interact/forms.html#h-17.4 shows the same
> > in a slightly more readable format - the only mentions of anything
> > deprecated (there are no references to anything obsolete) are for the
> > isindex element and the align attribute of the legend element.
> > 
> > What is the case regarding the name attribute is that it's been
> > deprecated for a few elements (such as a, form, frame, img) in XHTML1
> > and will be removed in XHTML2 (which we'll likely never see used in
> > browsers). See http://www.w3.org/TR/xhtml1/#h-4.10
> All this is fortunate, since I don't think PHP is even aware of the ID
> attribute. Imagine trying to process form fields without the "name"
> attribute being present.
> Paul
> -- 
> Paul M. Foster

Not sure if my other email got through earlier. Replacing the name
attribute on form fields with the id one is not feasible at all. They
don't even behave the same. What would happen if you had two forms on a
page that both had an element with the same name? Using the name
attribute, everything is fine, but not so if you were using the id

Going further, what about form elements sent as an array? I don't think
the id attribute is set up to follow any sort of array format (bearing
in mind also that it's only PHP that uses the [] suffix to denote a form
element be sent as an array). Doing so would break the functionality of
many pages today (no longer would DOM functions such as getElementByID()
work anymore because you'd be retrieving potentially more than one
element, so code like document.getElementById('element').style.something
wouldn't work.

Either way, the id attribute is not, and dare I say doesn't ever look to
be, a substitute for the name attribute on form elements.


Reply via email to