Results 1 to 5 of 5

Thread: multiple submit button - asp

  1. #1

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    56

    Unhappy

    I have a html form with, suppose, 3 submit buttons,how do i proceed to know (on the server side) wich one has been pressed ?


  2. #2
    Addicted Member
    Join Date
    May 2000
    Posts
    142
    use the onmousedown event of each button to fill a hidden form field with a string which identifies the button. then you can retrieve this hidden field upon submission.

    dvst8
    Secret to long life:
    Keep breathing as long as possible.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2000
    Posts
    56

    Smile

    thank you dvst8

  4. #4
    Addicted Member
    Join Date
    May 2000
    Posts
    142

    no prob

    i figured out how to do this 2 days ago
    Secret to long life:
    Keep breathing as long as possible.

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    But some browsers don't support onmousedown

    Yoiu could do somthing like this though:

    Code:
    <%@ Language=VBScript %>
    <HTML>
    <HEAD>
    
    <script language='Javascript'>
    function postit(str){
    
    document.frm1.txtKey.value=str;
    //alert(str);
    document.frm1.submit();
    }
    </script>
    </HEAD>
    <BODY>
    <%
    Response.Write request("txtKey") & " was pressed"
    %>
    <form name="frm1" action="ch.asp"><!--POST BACK TO ITSELF -->
    <input type=hidden name="txtKey">
    
    <INPUT type=button onclick="postit(this.name);" name="button1" value="button1">
    <INPUT type=button onclick="postit(this.name);" name="button2" value="button2">
    </form>
    </BODY>
    </HTML>
    Mark
    -------------------

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