submit form data in multiple buttons on a html form

Discussion in 'HTML' started by Matt, Jun 26, 2004.

  1. Matt

    Matt Guest

    The problem is I have 3 buttons that need to submit the form to different
    URL.
    My approach is to declare <input type="submit"> rather than <input
    type="button">.
    And put the following in the JavaScript:
    InputForm.action="URL LOCATION"
    InputForm.method="POST";

    I think we don't need InputForm.submit(); because <input type="submit">.

    Please advise and comment my approaches. Thanks!!

    ==============================================
    <html>
    <head>
    <script type="text/javascript">
    function onClickURL1()
    { InputForm.action="url1.asp"
    InputForm.method="POST";
    //InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
    }
    function onClickURL2()
    { InputForm.action="url2.asp"
    InputForm.method="POST";
    //InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
    }
    function onClickURL3()
    { InputForm.action="url3.asp"
    InputForm.method="POST";
    //InputForm.submit(); //NOT NECESSARY!! because of input type="submit"??
    }
    </script>
    </head>
    <body>
    <form name="InputForm">
    <P><input type="text" name="username">
    <P><INPUT type="submit" value="submit form data to URL1" name="action1"
    onclick="onClickURL1()">
    <P><INPUT type="submit" value="submit form data to URL2" name="action2"
    onclick="onClickURL2()">
    <P><INPUT type="submit" value="submit form data to URL3" name="action3"
    onclick="onClickURL3()">
    </form>
    </body>
    </html>
     
    Matt, Jun 26, 2004
    #1
    1. Advertisements

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. D. Shane Fowlkes
    Replies:
    3
    Views:
    848
    S. Justin Gengo
    Feb 24, 2004
  2. Klaas van Gelder
    Replies:
    2
    Views:
    11,002
    ahmadshakil
    Sep 27, 2006
  3. =?Utf-8?B?QWxleCBNYWdoZW4=?=

    Multiple "Submit" Buttons & Form Fields

    =?Utf-8?B?QWxleCBNYWdoZW4=?=, May 6, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    5,759
    Steven Cheng[MSFT]
    May 10, 2006
  4. Replies:
    4
    Views:
    1,251
  5. Matt
    Replies:
    2
    Views:
    289
    Bob Barrows [MVP]
    Jun 27, 2004
  6. c676228
    Replies:
    4
    Views:
    443
    c676228
    Apr 13, 2007
  7. sandyde2
    Replies:
    2
    Views:
    323
    sandyde2
    Oct 2, 2003
  8. Matt
    Replies:
    1
    Views:
    325
    Thomas 'PointedEars' Lahn
    Jul 5, 2004
Loading...