Re: name/id, forms, and XHTML

by "Darrell King" <darrell(at)webctr.com>

 Date:  Tue, 8 Oct 2002 14:51:49 -0400
 To:  <hwg-techniques(at)mail.hwg.org>,
"Greg Hart" <ghhart(at)earthlink.net>
 References:  1
  todo: View Thread, Original
I believe you need to have the name attribute right now to use forms.

One sure way to tell is the fact that the value of each id attribute must be
unique in the document.

I can tell you that form submissions using fields without name attributes do
not register those fields with the when using IE5.5.  I haven't tested
further.

D

----- Original Message -----
From: Greg Hart


I've read repeatedly that in converting from HTML to XHTML, you must at
least replace "name" with "id", or to keep older browsers happy, have both
present. I've also read in a few places that they have to be the same
value. Simple enough, until you get to elements such as checkboxes, radio
buttons, and the like, which before had to share the same "name" value.
So my question is, on form items where normally the name would have been
the same to group them, is this an unnecessary thing now, and we can name
them "orderitem1", "orderitem2", etc? And how does the form know they are
grouped, and should show up on the email side together (using Matt's
FormMail.cgi)? One example is where I'd have 20 or more checkboxes,
previously all marked as name="Purchase"...before, I'd see the incoming
order as Purchase: Item1, Item2, Item3, etc. Common sense tells me that if
I lose the name altogether, the script I had been using should break. I
haven't actually tested this theory yet, because the same issue is breaking
my JS as well.
Also, what browsers will be a problem and won't see the "id", requiring the
"name" be left in to process the form?
Just trying to get a handle on what the best way(s) to work forms are in
XHTML...
-Greg

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA