...

View Full Version : form id is an object



rhumbliner
05-28-2009, 06:59 PM
i've just come across the strangest problem and was hoping someone else has seen this.

i'm using multiple forms in a document and pass 'this' on the onSubmit event to tell the validation routine which form has been submitted. this has always worked just fine for me but i've got one document where the id property of the form is not a string, like i'd expect, but an HTMLInputElement! what the heck?

i've posted the complete page at http://www.meds4vets.biz/a.html. if you click any of the "update" buttons you'll see what i mean.

if anyone has any clues i'd appreciate some direction.

tia

randomuser773
05-28-2009, 10:31 PM
i've got one document where the id property of the form is not a string, like i'd expect, but an HTMLInputElement!Since your site won't load, best guess: you've probably named one of your fields 'id'.

Old Pedant
05-28-2009, 10:40 PM
How hard will you kick yourself??


<form id=f000005 action="/" method="post" onSubmit="return admin_p2(this)">
<input type=hidden name=page value=upd_product>
<input type=hidden name=id value="000005">

Now try using


<form id=f000005 action="/" method="post" onSubmit="return admin_p2(this)">
<input type=hidden name=page value=upd_product>
<input type=hidden name=ID value="000005">

Or some other name than "id".

Same thing happens when you name a form field as "action" or "submit". The form fields take precedence over the properties of the <form> object.

***********

Edit: RandomUser beat me to it, but I dunno why he says the site won't load. It loaded fine for me in both FF3 and MSIE6. Oh, well. He guessed right, of course.

rhumbliner
05-28-2009, 11:00 PM
kicking myself every so often is good for me -- keeps me humble. ;)

thanks guys, your experience saved me a lot of time.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum