W3C home > Mailing lists > Public > www-html@w3.org > March 2008

Re: Form control names: namespace without parent form

From: David Dorward <david@dorward.me.uk>
Date: Sun, 30 Mar 2008 09:51:59 +0100
Message-Id: <4A634316-3AD3-4E00-9BC0-2EA348172304@dorward.me.uk>
To: www-html@w3.org, Brian Beck <exogen@gmail.com>


On 28 Mar 2008, at 15:04, Brian Beck wrote:
>
> Forms in HTML documents[1] has this to say about the namespace of  
> control names:
>
>     "The scope of the name attribute for a control within a FORM
> element is the FORM element."

That refers to the scope for submitting form data using a form.

> However, it's perfectly valid to have controls without a parent FORM
> element, and the document doesn't seem to mention this:

It is valid, since the DTD doesn't forbid it, but I'm not sure DTDs  
are capable of making the distinction between an input that is the  
child of a div which is a descendent of a form, and an input which is  
the child of a div which is not.

You can't have form controls outside a form which do anything useful  
without a dependancy on JavaScript (which is generally a bad idea).

A name attribute on such a control (with the exception of radio  
buttons) would usually be pointless (you can just use the id instead).

Having an element with a name that is the same as the id of another  
element can cause problems in some browsers (Internet Explorer in  
particular since it has a tendency of treating name in the same was  
as id, to the extent of returning named elements with the  
getElementById method).

-- 
David Dorward
http://dorward.me.uk/
http://blog.dorward.me.uk/
Received on Sunday, 30 March 2008 08:52:45 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 27 March 2012 18:16:13 GMT