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 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Banging my Head!

    Code:
    function doSubmit()
    with (document.theForm) 
    {
       action = "https://www.mysite.com/";
       method = "post";
       target="_self";
       submit();
    }
    Code:
    <form name="theForm" method="POST" action="https://www.mysite.com/">
    ...
         ... inputs here...
    ... <input type="button" onClick="doSubmit();" value="submit me">
    </form>

    The form is a bit more complicated but you get the idea. Simple. straight forward... or at least it should be.

    when it gets to the "submit();" part i get this

    Line: 100
    Char: 6
    Error: Object doesn't support this property or method
    Code: 0
    URL: myurl

    Any help on this would be much appreciated.

    I'm running IE6 with SP2 and all updates AFAIK

    Thanks in advance.
    Last edited by aaronm; 08-04-2006 at 08:07 PM.

  • #2
    Senior Coder
    Join Date
    Feb 2006
    Location
    USA
    Posts
    1,013
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions
    Java != JavaScript && JScript != JavaScript
    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by Kravvitz
    with() is slow. I don't recommend its use at all.
    Agree! And it's somehow hard to handle, as you must remember all the time which is the associated root object. And, most important, you may not use another new object as root/associated inside.

    Use rather the self reference this

    function doSomething(f){
    ... now f replaces the form object
    }

    function doAnotherthing(f){
    ....
    }
    ...
    <form onsomeevent="doSomething(this)">
    .....
    <someformelement onsomeevent="doAnotherthing(this.form)">
    ...
    </form>
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,043
    Thanks
    0
    Thanked 251 Times in 247 Posts
    All your suggestions are valid but they are not the exact solution to the main problem.

    The reason submit() is not a valid method is because one of the form fields is named "submit" thus confusing the browser to think that you are referencing that field and not the form method submit(). If you rename that field to something else, the error will go away.

  • #5
    New to the CF scene
    Join Date
    Aug 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You sir, are the winner! Later that evening I noticed that the button was indeed named "submit" and changed it. Fixing the problem. Sometimes it amazes me how I can still miss the little things. Thanks for all the suggestions folks.


  •  

    Posting Permissions

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