Need help with form submit...

Discussion in 'Programming' started by StealthRT, Nov 7, 2006.

  1. #1
    Hello all i need help in automating this webmail script of mine. I need it to just act as a submit button once the page has loaded. However, it does not seem to work when i have the onload command in the body. But it DOES work when i simply click on the submit button... I've even tried a timer but still has the same results... what gives?
    
    <BODY BGCOLOR="#e8e8e8" onload="document.FrmLogin.submit()">
    <form name="FrmLogin" method="post" action="login.aspx" id="FrmLogin">
    <input type="hidden" name="__VIEWSTATE" value="dDwtMTM3NTQ1MDg0OTt0PDtsPGk8MT47aTwzPjs+O2w8dDw7bDxpPDA+Oz47bDx0PHA8bDxUZXh0Oz47bDxcPExJTksgUkVMPSJzdHlsZXNoZWV0IiBUWVBFPSJ0ZXh0L2NzcyIgSFJFRj0iL01lV2VibWFpbC9lbnRlcnByaXNlL3NraW5zL2VudGVycHJpc2UvbWUuY3NzIiBcPiA7Pj47Oz47Pj47dDw7bDxpPDA+O2k8MT47aTwyPjtpPDQ+O2k8Nj47aTw3PjtpPDg+O2k8OT47aTwxMD47aTwxMT47aTwxMj47PjtsPHQ8O2w8aTwwPjs+O2w8dDxwPGw8VGV4dDs+O2w8XDxJTUcgc3JjPScvTWVXZWJtYWlsL2VudGVycHJpc2Uvc2tpbnMvZW50ZXJwcmlzZS9sb2dpbi13aW5kb3dfbG9nby5naWYnXD47Pj47Oz47Pj47dDw7bDxpPDA+Oz47bDx0PHA8bDxUZXh0Oz47bDxQbGVhc2UgZW50ZXIgeW91ciBVc2VybmFtZSBhbmQgUGFzc3dvcmQgdG8gbG9nIG9uLjs+Pjs7Pjs+Pjt0PDtsPGk8MD47PjtsPHQ8cDxsPFRleHQ7PjtsPFVzZXJuYW1lOjs+Pjs7Pjs+Pjt0PDtsPGk8MD47PjtsPHQ8cDxsPFRleHQ7PjtsPFBhc3N3b3JkOjs+Pjs7Pjs+Pjt0PDtsPGk8MD47PjtsPHQ8cDxsPFRleHQ7PjtsPFNraW46Oz4+Ozs+Oz4+O3Q8dDw7dDxpPDM+O0A8QmFzaWM7RGVzZXJ0O0VudGVycHJpc2U7PjtAPEJhc2ljO0Rlc2VydDtFbnRlcnByaXNlOz4+Oz47Oz47dDw7bDxpPDA+Oz47bDx0PHA8bDxUZXh0Oz47bDxMYW5ndWFnZTo7Pj47Oz47Pj47dDx0PHA8cDxsPERhdGFWYWx1ZUZpZWxkO0RhdGFUZXh0RmllbGQ7PjtsPEtleTtWYWx1ZTs+Pjs+O3Q8aTw1PjtAPEdlcm1hbjtFbmdsaXNoO1NwYW5pc2g7RnJlbmNoO0l0YWxpYW47PjtAPGRlO2VuO2VzO2ZyO2l0Oz4+O2w8aTwxPjs+Pjs7Pjt0PHA8cDxsPFRleHQ7PjtsPExvZ2luOz4+Oz47Oz47dDxwPHA8bDxUZXh0Oz47bDxSZW1lbWJlciBteSBzZXR0aW5ncyBmb3IgdGhpcyBjb21wdXRlcjs+Pjs+Ozs+O3Q8O2w8aTwwPjs+O2w8dDxwPGw8VGV4dDs+O2w8JmNvcHlcOyBNYWlsRW5hYmxlIFB0eS4gTHRkLiwgMjAwMS0yMDA2LiBBbGwgcmlnaHRzIHJlc2VydmVkLlw8QlJcPlRoaXMgY29tcHV0ZXIgcHJvZ3JhbSBpcyBwcm90ZWN0ZWQgYnkgY29weXJpZ2h0IGxhdyBhbmQgaW50ZXJuYXRpb25hbCB0cmVhdGllcy5cPEJSXD5VbmF1dGhvcml6ZWQgcmVwcm9kdWN0aW9uIG9yIGRpc3RyaWJ1dGlvbiBvZiB0aGlzIHByb2dyYW0sIG9yIGFueSBwb3J0aW9uIG9mIGl0LFw8QlJcPm1heSByZXN1bHQgaW4gc2V2ZXJlIGNpdmlsIGFuZCBjcmltaW5hbCBwZW5hbHRpZXMuOz4+Ozs+Oz4+Oz4+Oz4+O2w8Y2hrUmVtZW1iZXI7Pj4=" />
    			<CENTER>
    <div align="center"><b> Username:</b> 
    <input name="txtUsername" type="hidden" class="ME_Input" id="txtUsername" style="width:170px" value="ME@aol.com" />                          
                                <b> <br>
                                Password:</b>                            
    <input name="txtPassword" type="hidden"" class="ME_Input" id="txtPassword" style="width:170px" value="XXXXXXX" />                          
                                <b><br>
                                Skin:</b><b>
    <select name="ddlSkins" id="ddlSkins" style="display: none;"><option selected="selected" value="Enterprise">Enterprise</option></select>
                                </b> <b><br>
                                Language:</b><b>
    <select name="ddlLanguages" id="ddlLanguages" style="display: none;"><option selected="selected" value="en">English</option></select>
                                                        <br>
    <input type="submit" name="btnLogin" value="Login" id="btnLogin" class="ME_LoginButton" style="CURSOR:pointer" />
    </div>
    </CENTER>
    </form>
    
    Code (markup):
    Any help would be great! :)

    David
     
    StealthRT, Nov 7, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    You want to submit the form as soon as the page loads?

    
    <script type="text/javascript">
    window.onload = function()
    {
         document.FrmLogin.submit();
    }
    </script>
    
    Code (markup):
    EDIT:

    I didn't see you already tried something like this. If that doesn't work either, try document.forms[0] instead of document.FrmLogin
     
    nico_swd, Nov 7, 2006 IP
  3. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Sadly nico_swd it still does the same thing even when i put the document.forms[0] on it :(

    It doesnt seem to really "push" that submit button since i put a onmousedown alert box on it and it never pops up after the javascript submits it, however it does pop up if i push the button myself...

    Any other ways to do this?

    David
     
    StealthRT, Nov 7, 2006 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #4
    There's a syntax error in your HTML

    
    input name="txtPassword" type="hidden""
    
    Code (markup):
    There are 2 qoutes at the end. However, your code seems to work for me.
     
    nico_swd, Nov 7, 2006 IP
  5. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Yeah i already took that out... still does the same though.

    :(

    David
     
    StealthRT, Nov 7, 2006 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    Hm, it works for me on Firefox and IE. Try placing this under the form.

    
    <script type="text/javascript">
     document.FrmLogin.submit();
    </script>
    
    Code (markup):
    And take out the onload event.
     
    nico_swd, Nov 7, 2006 IP
  7. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Tryed that.... sadly it does not work either....

    Here u can try it for yourself on my site...
    http://mycfajob.com/webmail.html

    Let it count down from 4 and see what happens.. then reload it and hit the button without waiting on it to count down.

    David
     
    StealthRT, Nov 7, 2006 IP
  8. StealthRT

    StealthRT Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ok got it!
    
    onLoad="FrmLogin.btnLogin.click()"
    
    Code (markup):
    David
     
    StealthRT, Nov 7, 2006 IP