Id vs. Name and IE PC

I finally sussed out why readers of this site using Internet Explorer PC could not comment or communicate. Upon submitting a form they were being told to enter a name despite having already done so. Apparently IE PC (forever the boon of the careless, lazy coder) uses the name and id attributes interchangeably. My client-side validation script makes sure that <input id="author"> has a value before submitting the form by using document.getElementById('author').value to access that value.

The HTML validated; all the tags were properly nested. No problems in any other browser. I disabled all other scripts that were running on the page thinking maybe one of them was invalidating the page at run time—my Flash image replacement script in particular because it adds and removes elements from the document tree.

It wasn’t until I removed all my head tags that I discovered the source of the problem. IE PC was finding this, <meta name="author" content="Shaun Inman"> instead of the <input> tag. Technically, both the name and id attributes should be unique (the <meta> tags were a last minute addition) but is the function name not getElementById()?

Previous
Hot like Wasabi
Next
Identity Theft
Author
Shaun Inman
Posted
February 20th, 2004 at 9:18 pm
Categories
JavaScript
Movable Type
Comments
003 (Now closed)

003 Comments

001

Has anybody else noticed that Safari 1.2 (possibly older versions too) adds a single space after all inline elements? The bug appears twice in the post above. After the communicate link and the italicized portion of getElementById before the parentheses. And then again, a third time, before the final question mark following the <code> block.

First Microsoft, now Apple—who else wants on my list? ;D

Author
Shaun Inman
Posted
Feb 20th, 2004 4:58 pm
002

Hmm, no space with firebird but I did get a fouc! Weird, I was ‘low on bandwidth at the time’ but yer page came up ‘neked’!

Zoinks! I never noticed that ‘instant’ preview last time I was here. Uber-cool.

Author
mike
Posted
Feb 21st, 2004 7:40 am
003

Yeah. This is not the only problem with IE, There are far too many to list here, even after the source code has been slipped ;)

Author
after
Posted
Feb 21st, 2004 5:54 pm