Re: Form control names: namespace without parent form

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 UTC