SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JavaScript: form submission problem

    Hi all,

    Can you help? I'm having trouble with the following code. When I view the page and click on the link the text boxes should be updated and the form should be submitted.

    The updates work fine but the form submission fails. I get the message: "object doesn't support this property or method".

    I'm working with IE 5.00.3314 (I know - but its a corporate standard).

    Any ideas?

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    
    <html>
    <head>
    	<title>Untitled</title>
    	<script language="JavaScript1.2">
    		function go(month, year) {
    			myForm.curMonth.value = month;
    			myForm.curYear.value = year;
    			myForm.submit();
    			return true;
    		}
    	</script>
    </head>
    
    <body>
    
    <form name="myForm" action="test.cfm" method="POST">
    	<input type="text" name="curYear">
    	<input type="text" name="curMonth">
    	<input type="submit" name="submit" value="submit">
    </form>
    
    <a href="#" onclick="return go('aaaMonth', 'aaaYear');">testing</a>
    
    </body>
    </html>
    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried document.myForm.submit()? With Netscape you would need that anyways for it to work correctly.

  3. #3
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by requestcode
    Have you tried document.myForm.submit()? With Netscape you would need that anyways for it to work correctly.
    Yep - tried that, no joy.
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com

  4. #4
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I believe your problem is this line:
    <input type="submit" name="submit" value="submit">

    You need to change the name from "submit" to something else. JavaScript is getting confused with that. try that and it should work

  5. #5
    SitePoint Zealot easyrew's Avatar
    Join Date
    Nov 2001
    Location
    Milton Keynes, UK
    Posts
    186
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by requestcode
    I believe your problem is this line:
    <input type="submit" name="submit" value="submit">

    You need to change the name from "submit" to something else. JavaScript is getting confused with that. try that and it should work
    Aha - now we're getting somewhere...I changed the code to:
    Code:
    <input type="submit" name="mySubmit" value="click here to submit">
    Now the error no longer appears - but the form still doesn't submit. Grrrr!!

    Rich
    If a man stands alone in the forest
    and there's no woman around to hear him,
    is he still wrong?
    w: www.EasyRew.com


Bookmarks

Posting Permissions

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