Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Nov 2003
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts

    submit() - object does not support

    When using the submit() method on a form I am getting an "Object does not support this method" error. The form does post itself so it recognizes the command.

    I have tried many ways of identifying the form but I still get the same error.

    I would appreciate any advice. Thanks.

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    I would appreciate any code. Thanks.

  • #3
    New Coder
    Join Date
    Nov 2003
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok, I believe the following two statements are the only ones involved and that they are isolated.. in JS and html.

    Code:
    // This is called at the end of a function
    
    document.getElementById('contactform').submit();
    
    <!-- ...and the form tag -->
    
    <form action="process.php" id="contactform" method="POST">

    I get: "Object does not support this property or method" Code 0

    I would like to use a plain button or image link to send the form (not a submit button). I should correct that the form only submits if I use a submit button which actually means the submit() method does not work at all.

    Which brings me to ask if there are any good Javascript debugging/helper programs or plugins. I have tried JSLint and the IE but they both have their limits of usefullness.

    Thanks.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Try changing the name of your submit button to "Walter". I am not kidding.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Posts
    626
    Thanks
    0
    Thanked 0 Times in 0 Posts
    What they are trying to tell you is that you are not providing enough information for them to help you. Perhaps you could provide a link to the page or post all of your code here. Also, try running it in one of the Mozzila browsers and then check the Javascript Console under Tools to see what the errors are. They will give you more descriptive messages then IE does.

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Try changing the name of your submit button to "Walter". I am not kidding.

  • #7
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    	<head>
    		<title>46621</title>
    	</head>
    	<body>
    		<form action="reciever" method="get">
    			<input name="text" type="text" value="success">
    		</form>
    	</body>
    	<script type="text/javascript">
    		document.getElementsByTagName("form")[0].submit();
    	</script>
    </html>

  • #8
    New Coder
    Join Date
    Nov 2003
    Posts
    29
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ok. Mozilla gives me pretty much the same error. Function not supported. I have not figured out how to use Venkman yet.


    Here is the full page stripped down to the problem (even with the walter(?) and TagName methods):


    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html><head><title>Untitled</title>
    <script language="JavaScript" type="text/javascript">
    
    function submitForm(){
    document.getElementsByTagName('form')[0].submit();
    //document.getElementById('walter').submit();
    } 
    
    </script></head><body>
    
    <form action="lookup.php" id="walter" method="POST">
    <input type="text" id="firstname" name="firstname" />
    <button onclick="submitForm();" id="submit" class="buttonForm" value="">Send</button>
    </form>
    
    </body></html>

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    You forgot to Capitalize 'Walter' ! You forgot to Capitalize 'Walter' ! Aaaaarrrggghhh......

    OK, sorry, but every time I see this one, it makes me lol. The only possible way the Form.submit() method could be 'not support[ed]' is if you've over-written it. Like so:

    <input type="submit" name="submit" />

    Form.submit now contains a reference - to a button. Not much point in calling that. I have no idea how browser manufacturers let this one slip by, it's such an obvious pitfall. Join the club.

    Submitting a form the usual way - submit button, image, hitting <enter> in a textfield, doesn't call Form.submit(), which (I assume) is just a JS wrapper. That's why they still, erm, function.

    Just ignore all the other silly advice - except that 'Walter' business of course - and go back to what you had, with a new name. Walter.

  • #10
    New to the CF scene
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    LOL, adios - you are a complete ***.. but classic at the same time.. yer changed it to 'Walter' and yep, it worked...

    Something to keep an eye out for next time.. LOL...


  •  

    Posting Permissions

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