checking for which button is pressed

  • Thread starter Thread starter darrel
  • Start date Start date
D

darrel

I have a file upload tool.

Before I save the file to a directory on the server, I first check to see if
that file exists. If it does, I exit out of the 'save' function and display
a different panel that will say:

==============================================
File exists. Do you want to save over the current file?
[ Save Over] [ Cancel ]
==============================================

I want to be able to check to see which button was selected. I could easily
do this if they were radioButtons, as I'd just check to see which one was
selected. Is there an equivalent for buttons? Or do I have to do something
more complex like setting a public string to a value based on the event
handlers for each button?

-Darrel
 
If you're doing an ASP page, just create two server side buttons, and add
code to their event handlers.
 
If you're doing an ASP page, just create two server side buttons, and add
code to their event handlers.

The issue is that a function is run either way. I think the solution is on
the handler, set a variable, THEN call the function...

-Darrel
 
Well, for good'ol manual HTML controls, you could do this:

<input type="submit" name="save_over" value="Overwrite">
<input type="submit" name="save_over" value="Cancel">

Notice that the two inputs have the same name.

Then, when you want to check to see if they clicked Overwrite, do this:

If Request.Form("save_over") = "Overwrite" Then
..
..
..
End If


The comparison is case sensitive
 
Back
Top