Results 1 to 3 of 3

Thread: 2 submit buttons on one form

  1. #1

    Thread Starter
    Lively Member nutstretch's Avatar
    Join Date
    May 2000
    Location
    UK
    Posts
    85
    I have a form in which the user chooses a record and then decides whether to edit or delete the record. How can i put two submit buttons pointing to two different forms on one form.
    if at first you don't succeed, drink the rest of the bottle and loop to the same place tomorrow

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    you can do something like this

    <HTML>
    <HEAD>
    <SCRIPT language="javascript">
    function changeSubmit(formnum)
    {
    if (formnum == 1)
    {
    document.myform.action = "page1.asp";
    document.myform.submit();
    }
    if (formnum == 2)
    {
    document.myform.action = "page2.asp"
    document.myform.submit();
    }
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <FORM name="myform">
    <INPUT type="button" value="edit" onclick="changeSubmit(1);">
    <INPUT type="button" value="Delete" onclick="changeSubmit(2);">

    </FORM>
    </BODY>
    </HTML>

    hope this helps

    Ian
    Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!

  3. #3
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Or you can just use two submit buttons and determine which one was clicked in the form's onsubmit event.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

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



Click Here to Expand Forum to Full Width