is null or not an object error - IE8/9 on Windows 7
I have this form (old code I am maintaining):
<form name="mtc_ots" method=post action="process.php">
<input type="hidden" name="reqtsnc" value="1">
<input type=button onclick="document.mtc_ots.reqtsnc.value='1';submit();">
I've only been able to duplicate the error on Windows 7 IE 8 + 9 ..
Message: 'document.mtc_ots.reqtsnc' is null or not an object
Any idea why this is happening? Tearing my hair out here. Tried debugging in FF/Chrome but not even getting a warning.
I tried changing the button to just me a regular <input type=submit> deal, but for some reason the form doesn't process as it should, doesn't send the file attachments along with it, so I'm sure the previous developer went that route for some reason -- I just haven't figured out why yet.
Thanks for any assistance.
Post a link to a test page.
Important: make sure there is no other element with the name="submit" nor id="submit". IE will hesitate between submit and submit(), as it is able to take the ids and names as Global variables.
<input type="button" onclick="reqtsnc.value='1';this.form.submit();">
This seems to have fixed it. Was going to be hard/impossible for me to post a test page due to NDAs and such.
What was exactly wrong with what was being done before? I'm just curious and want to learn. Not sure why it was only occurring on Windows 7 IE, I couldn't duplicate it on my XP box with IE6/7/8.
Originally Posted by
<input type=button onclick="document.mtc_ots.reqtsnc.value='1';
;"> submit() submit() is a method which must belong to a FORM element. Written alone, it will be taken as a function belonging to the Global Window Object, which is illogical. IE9/Win7 is right.
Users Browsing this Thread
There are currently 1 users browsing this thread.
(0 members and 1 guests)