Weird JavaScript problems (January 3rd, 2006)

For quite some time I have been trying to track down a strange Javascript error. In one of the forms in our application, we have a dynamically generated set of DOM form fields generated on the fly via Javascript. Something like “document.myForm.appendField(field);”. The page in question worked just fine in Opera and Firefox, but refuses to work in IE with no errors. It turns out that all of the fields had the same name AND Opera/Firefox took the first field while IE rightfully so refused and returned a collection instead. For example:

alert(document.myForm.field.value)

However there are multiple “field” fields in the form, and for some reason both Opera and Firefox returned only the first one. Unfortunatly, I was not able to reproduce the problem in a standard alone web page.

Comments?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s