Convert form to submit on load instead of clicking submit button?

Discussion in 'HTML' started by Network-Man, Jun 4, 2005.

  1. Network-Man

    Network-Man Guest

    I am trying to streamline a form that in itself streamlines logging into a
    site. Is there a way to make a form submit "onload" without clicking a
    submit button?


    <p><form
    action="https://hostname.domain.com/ui/status/index.php?&DashBoardID=1&DashB
    oard=Standard%20Services" method="post" target="_blank"><br />
    <input type="hidden" name="LoginEmail" value=""><br />
    <input type="hidden" name="LoginPassword" value="mycleartextpassword"><br />
    <input type="submit" name="Authenticate" value="Login"><br />
    <input type="hidden" name="Action" value="1" ><br />
    </form></p>


    Users want a a shortcut that when they open it it goes straight to the
    destination page of their dashboard. It's *too much trouble* having to open
    the page that has this form and click on the login button. Is there a way I
    can pass the same information without using a form? Security isn't an issue.

    TIA
     
    Network-Man, Jun 4, 2005
    #1
    1. Advertising

  2. Network-Man

    Toby Inkster Guest

    Network-Man wrote:

    > I am trying to streamline a form that in itself streamlines logging into a
    > site. Is there a way to make a form submit "onload" without clicking a
    > submit button?


    <form id="foo">
    ....
    </form>
    <script type="text/javascript">
    function myfunc () {
    var frm = document.getElementById("foo");
    frm.submit();
    }
    window.onload = myfunc;
    </script>

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
     
    Toby Inkster, Jun 4, 2005
    #2
    1. Advertising

  3. Network-Man

    Network-Man Guest

    Toby,
    It worked like a charm.
    I knew it would have something to do an "onload" statement, but that's as
    close as I could get.
    Thanks.

    -Joel

    "Toby Inkster" <> wrote in message
    news:p...
    > Network-Man wrote:
    >
    > > I am trying to streamline a form that in itself streamlines logging into

    a
    > > site. Is there a way to make a form submit "onload" without clicking a
    > > submit button?

    >
    > <form id="foo">
    > ...
    > </form>
    > <script type="text/javascript">
    > function myfunc () {
    > var frm = document.getElementById("foo");
    > frm.submit();
    > }
    > window.onload = myfunc;
    > </script>
    >
    > --
    > Toby A Inkster BSc (Hons) ARCS
    > Contact Me ~ http://tobyinkster.co.uk/contact
    >
     
    Network-Man, Jun 5, 2005
    #3
  4. Network-Man

    terax

    Joined:
    Apr 7, 2008
    Messages:
    2
    It redirects me to login page... only button works. Why?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <body onLoad="myfunc()">
    <form action="http://cportal.webd.pl/login.php" method="post" target="_top" id="foo">
    [...]
    </body>
    </form>
    <script type="text/javascript">
    function myfunc () {
    var frm = document.getElementById("foo");
    frm.submit();
    }
    </script>
     
    terax, Apr 7, 2008
    #4
  5. Network-Man

    terax

    Joined:
    Apr 7, 2008
    Messages:
    2
    It redirects me to login page... only button works. Why?

    <body onLoad="myfunc()">
    <form action="http://cportal.webd.pl/login.php" method="post" target="_top" id="foo">

    +

    <script type="text/javascript">
    function myfunc () {
    var frm = document.getElementById("foo");
    frm.submit();
    }
    </script>
     
    terax, Apr 7, 2008
    #5
  6. Network-Man

    gaul1

    Joined:
    Jul 7, 2012
    Messages:
    1
    tnx

    Hey Toby Inkster
    Thanx a lot. You saved my day :D
     
    gaul1, Jul 7, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    1,776
    Grant Wagner
    Dec 23, 2004
  2. Paul Furman
    Replies:
    4
    Views:
    1,039
    Paul Furman
    Mar 17, 2007
  3. Marcelo

    "Failed to load viewstate" when clicking button

    Marcelo, Nov 6, 2006, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    354
    Brennan Stehling
    Nov 6, 2006
  4. Replies:
    1
    Views:
    158
    Grant Wagner
    Dec 23, 2004
  5. ljlolel
    Replies:
    2
    Views:
    519
Loading...

Share This Page