Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sending form's submit button's value?

Tags:

html

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>  
like image 497
Efe Avatar asked Aug 19 '09 04:08

Efe


3 Answers

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
like image 158
nickf Avatar answered Oct 06 '22 17:10

nickf


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

like image 24
fphilipe Avatar answered Oct 06 '22 17:10

fphilipe


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

like image 37
Cullen Walsh Avatar answered Oct 06 '22 17:10

Cullen Walsh