View Full Version : Having 2 Buttons in 1 Form Tag
Hi All,
pls is it possible to have two submit button pointing to two different .asp (action=---.asp) within one form tag element?
Abd
Vladdy
04-02-2003, 05:10 PM
With the help of javascript - yes. You change form.action using button's onclick.
http://www.codingforums.com/showthread.php?s=&threadid=17147
easiest way is just giving the submit buttons different values (but same name) and performing actions or a redirect on the page that the action points to, depending on the value for the submitbutton that was clicked (submit buttons have same name but different value)
Hi raf,
any piece of code base on your suggestion, that is;
[easiest way is just giving the submit buttons different values (but same name) and performing actions or a redirect on the page that the action points to, depending on the value for the submitbutton that was clicked (submit buttons have same name but different value)]
Thanks
Abd
HTML code for the form
<form name="multiplesubmit" action="process.asp" method="post">
<input type="submit" value="delete" name="action">
<input type="submit" value="update" name="action">
</form>
VBscript code for in process.asp
if request.form("action") = "delete" then
your code that needs to be executed when button 1 is clicked
else
if request.form("action") = "update" then
your code that needs to be executed when button 2 is clicked
else
response.write("Error. How did you get to this page you ***. I've logged your IP and will take appropriate actions")
end if
end if
If you have more then 2 buttons, you probably best use a "select case" in stead of the "if then".
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.