Determine Which Submit Button Was Clicked

Determine Which Submit Button Was Clicked

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?


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 codeEnd Select

See also  How College Students Can Shape the Future of Tech Responsibility

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist