5

I was wondering if it is possible to place 2 submit buttons if send either of its information when click.

Example:

 <form method="post" action="content/requests/index.cs.asp?Process=RespondRequests" id="REQUESTFORM">
        <input type="hidden" name="REQUESTID" value="<%=objRequests("REQUESTID")%>">   
        <input type="hidden" name="BYID" value="<%=objRequests("BYID")%>">   
        <input type="hidden" name="TOID" value="<%=objRequests("TOID")%>">   
        <input type="submit" name="respond" value="Confirm" class="btn_confirm" />
        <input type="button" name="respond" value="Ignore" class="btn_ignore" />
 </form>  
Andy Gaskell
  • 30,917
  • 5
  • 76
  • 80
Efe
  • 279
  • 2
  • 4
  • 9

3 Answers3

8

Given your code there, if you change the ignore button to be type="submit" then it'll do what you want.

In the POST, you'll see this:

// if Confirm clicked:
REQUESTID -> requestId
BYID -> byId
TOID -> toId
respond -> Confirm

// if Ignore clicked:
REQUESTID -> requestId
BYID -> byId
TOID -> toId
respond -> Ignore
nickf
  • 520,029
  • 197
  • 633
  • 717
5

Remember, hitting enter on the form is like clicking on the submit button that appears first in your source.

fphilipe
  • 9,170
  • 1
  • 34
  • 50
1

Just set them both to type="submit". It will already do that.

Cullen Walsh
  • 4,208
  • 1
  • 15
  • 12