www.webdeveloper.com
Results 1 to 4 of 4

Thread: is null or not an object error - IE8/9 on Windows 7

  1. #1
    Join Date
    May 2011
    Posts
    2

    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">

    (form data)

    <input type="hidden" name="reqtsnc" value="1">
    <input type=button onclick="document.mtc_ots.reqtsnc.value='1';submit();">

    </form>

    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
    Line: 704
    Char: 1
    Code: 0
    URI: https://www.themediatrust.com/process.php

    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.

  2. #2
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Post a link to a test page.

    Try:
    Code:
    <input type="button" onclick="reqtsnc.value='1';this.form.submit();">
    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.

  3. #3
    Join Date
    May 2011
    Posts
    2
    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.

    Thanks!

  4. #4
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by BilldaCat View Post
    What was exactly wrong with what was being done before? I'm just curious and want to learn.
    Probably:
    Code:
    <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.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles