IE name="name" & form.name property bug

J

Java script Dude

We just discovered another IE bug.

When an html form contains an element with a name of `name` IE's
internal index screws up the .name property of the containing form to
point to the bad element object instead of containing the string name
property of the form.

Here is the simplified test case:

<html>
<head>
<title>IE Name="name" Bug</title>
<script>
function showFormName(){
alert(
"Text should say `fmTest`~~~> "+
oF["good_name"].form.name+"\n\n"+
"Second test: Test .value prop~~> "+
oF["good_name"].form.name.value
)
}
</script>
</head>
<body>
<form name="fmTest">
<script>oF=document.forms["fmTest"]</script>
Good:
<input type=text name="good_name" value="Good Elem Name">
<script>showFormName()</script>
Bad:
<input type=text name="name" value="Bad Elem Name">
<script>showFormName()</script>
</form>
</body>
</html>

Probably not a good idea to use just `name` anyway `tbName` or similar
is better coding practice any how. We are customizing a system that
uses form element names that match attribute names in our business
object server. `name` is actually the core business object `name`
attribute. We are working around by customizing the TCL core code to
look for obj_name instead.

JsD
 
R

Richard Cornford

Java said:
We just discovered another IE bug.

It isn't necessarily a bug and it certainly isn't restricted to IE.
When an html form contains an element with a name of `name` IE's
internal index screws up the .name property of the containing form to
point to the bad element object instead of containing the string name
property of the form.
<snip>

"The Most Common Mistake":-

<URL: http://jibbering.com/faq_notes/form_access.html#faComMis >

Richard.
 
R

Richard Cornford

Randy said:
Andrew Urquhart wrote:

Thanks, I knew it was in there somewhere :)

Sorry, it had just occurred to me that I forgot the /faq and I was about
to post a correction. I won't bother now.

Ricahrd.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top