Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Web
Expertise: Beginner
Mar 29, 1999

Using Multiple Submit Buttons with Select Case

It is common to have a Web page that calls itself. On this page, you may want to have many buttons that will each produce a different call. An example is a page that allows you to navigate, add, edit, or delete a record/recordset. You can accomplish this by appending special commands to the URL, exposing some implementation details. However, it is also possible to do this through a Post method. When a form has multiple submit buttons all with the same name, the value of the button will be returned via a Post method. You can then use this value to determine your action.
 
<HTML>
<BODY>
<FORM METHOD=POST>
<P><INPUT TYPE=SUBMIT VALUE="Move First" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Move Previous" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Move Next" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Move Last" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Add" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Edit" NAME=SUBMIT>
<P><INPUT TYPE=SUBMIT VALUE="Delete" NAME=SUBMIT>
<HR>
<%
Select Case Request.Form("SUBMIT")
	Case "Move First"
		Response.Write "<P>Do Move First"
	Case "Move Previous"
		Response.Write "<P>Do Move Previous"
	Case "Move Next"
		Response.Write "<P>Do Move Next"
	Case "Move Last"
		Response.Write "<P>Do Move Last"
	Case "Add"
		Response.Write "<P>Do Add"
	Case "Edit"
		Response.Write "<P>Do Edit"
	Case "Delete"
		Response.Write "<P>Do Delete"
	Case Else
		Response.Write "<P>Invalid Action"
End Select
%>
</FORM>
</BODY>
</HTML>
William Wen
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date