Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

capturing 'button click' event

Status
Not open for further replies.

anchal

Programmer
Sep 4, 2001
11
US
Hi,

Is there a way to know which button was clicked by the user on a 'file download' dialog box e.g. 'Ok' or 'Cancel' button?

Thanks,
Anchal.
 
what is the use in knowing it?

Known is handfull, Unknown is worldfull
 
Hi,
This is in connection with the query posted in Java (sun) forum dated Jul 31, 2003 and titled 'automatic redirect after file download'.
Any suggestions?
Thanks,
Anchal.
 
hi read ur thread in java. that is absolutely not possible. reasons:

1. there is no javascript event to capture ok and cancel.
2. once headers are sent to the browser (response.sendHeader) a response.Send wont work...

how do the users come to this page?

Known is handfull, Unknown is worldfull
 
Hi,
Do you mean the page that contains the link? Well this page contains links corresponding to transactions. Since I'm using Struts, an Action class is responsible for forwarding the request to a JSP say 'main.jsp' that displays this page. When user clicks a link say 'T1' on this page, the request again goes to the Action class which then creates an xml file on the server. The request is now forwarded to the JSP that displays the 'file download' dialog box on the client browser.
The requirement is:
1. If the user selects 'Ok' button on the dialog box and completes the download process, a request should go to the Action class which would change the status of the transaction. The request should now be forwarded to 'main.jsp' to display the page without the link 'T1'.
2. If the user selects 'Cancel' button on the dialog box, nothing should happen.
Regards,
Anchal.
 
You can use server side sessionID to see if the download was requested, thereby knowing if the user clicked OK.

You can create a variable in Javascript to know if the user clicked the download button.

The combination would expose:

1. If download button was never clicked
2. If download button was clicked && file not requested
3. If download button was clicked && file was requested

That's the best I can come up with right now :(
 
nope thats nealry impossible. there is no WAY to know whether the user did really download....

Known is handfull, Unknown is worldfull
 
Hi,

Thanks for your guidance. But I still don't get as to how I should know whether the button clicked was the 'Ok' button or 'Cancel' button to assign an appropriate value to the JavaScript variable! For that matter capturing any event associated with 'file download' dialog box is a mystery to me (even its creation and closing)! Use of sessionID is also not clear to me.
Your help would be much appreciated.

Thanks,
Anchal.
 
Looks like I'll have to modify the functionality itself..!!
Thanks anyway..!! :)
Regards,
Anchal.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top