[Pdx-pm] CGI.pm -- names verses ids

Randall Hansen randall at sonofhans.net
Tue May 3 17:09:14 PDT 2005

On May 3, 2005, at 4:39 PM, Roderick A. Anderson wrote:

> Not to mention it is getting rather tedious typing both a name and id 
> attribute for almost every form element.

it is a little tedious; hard to avoid, though.  "id" is a unique 
identifier for the element in the document (in short, a DOM id).  even 
if you don't use any style sheets or active scripting, "id" is useful 
for labels.  "name" is the control name for the associated control 
(e.g. an input box); it does not need to be unique.

> So what is suppose to happen when I click [Submit] on my form and I 
> only have an id attribute for an element?

according to the spec[1], nothing.  for a control to be "successful" (a 
term of art, in this case) a name is required.


1) http://www.w3.org/TR/html4/interact/forms.html#h-17.13.2

More information about the Pdx-pm-list mailing list