I don’t know about you, dear reader, but I once had the misfortune to read the “HTML compatibility guidelines” for XHTML authors written by W3C.  I can’t blame my silly mistakes on that well-meaning document, however.

Yes, we all make mistakes.  Mine was mistakenly thinking that the HTML name attribute was deprecated for all elements, including form elements.  In actuality, though XHTML deprecates the name attribute on anchor tags and the form itself, the name attribute is an integral part of XHTML forms — as much as HTML forms.

Here was where I got lost in illogic.  In order to create a set of related radio inputs or checkbox inputs in a form, you give all those inputs an identical name.  For a radio, this will cause the average browser to enforce the only-select-one rule.  Since I had mistakenly assumed that name was deprecated, I would use both id and name on a form input and give them all the same token, like “favorite_food” (or whatever).

Obviously this is wrong.  I swear I did know that id was supposed to be unique–really, I did–I just thought that a form would have to be an exception with id replacing name someday (which is not happening).  But it wasn’t that big a deal until a bug showed up in Firefox, making it pretty much impossible to successfully use an input if its id was duplicated elsewhere.

I wrote up a big ol’ document about it.  Probably more than it deserves, but I guess I was bored.  Check out HTML / XHTML Forms: Using ID and NAME.