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: Active Server Pages (ASP)
Expertise: Beginner
Oct 21, 1999

Determine Which Submit Button Was Clicked

Question:
I have a Web page with a form(action=sample.asp),frmProduct. The form has some textboxes (one of which is a key field, sav txtKey) and two submit buttons: one for retrieve (btnRetrieve) and one for delete (btnDelete). In sample.asp, how do I find out which button was clicked?

Answer:

Name all the buttons on your form with the same name "CMD". They obviously have different VALUEs—the caption on the button. Then, in your sample.asp page, you can find out which button was pressed and accordingly take action:

Select Case Trim(Request("CMD"))
   Case "Retrieve"
      ...retrieval code
   Case "Delete"
      ...deletion code
End Select
DevX Pro
 
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