• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Enable/disable buttons - File download(CSV)

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a JSP page where I have a submit button. When user click the submit button, query gets executed in the backend. I need to disable a button till the query gets executed and displayed in 'csv' format. After that i again want to enable the button.

Disabling the button is not a problem, but I am not able to enable the button once the download is complete since once we display the Save As dialog box for CSV download, the control is with the browser.

Is there any way I can enable the button again without manually refreshing the page..
 
Ranch Hand
Posts: 173
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One of the things we do is set a timer on the button so that the user cannot be accidentally pressed again for x seconds. You could get your jsp to open a _blank page that contains the execution for the download and only enable the download button when the page closes.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This seems a tad odd. If your submit is a typical GET/POST for a form to the server then your page is going to reload no matter what. When the page refreshes, assuming your server returns to the same page, your button will be enabled because that is the default behavior when the page first loads.

If you are doing a different type of submit then you need to tell us.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the content dispostion is set up as an attachment, the current page will not be replaced. But there is no way to detect when the user saves the file to the disk.
 
sanju juhi
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks a lot for the help.....

Ok....Actually what we have in the web page exactly is "Save a Copy" button...

1) The user clicks on the "Save a Copy" button.
2) The button should be disabled..
3) The query will fetch million of records from the database(This will take few minutes)..So we dont want the user to click the button again while processing..
4) Once the processing is done....we open a CSV file from the servlet program using :

res.setContentType("application/text;name=" + "REPORT.CSV");
res.setHeader("Content-Disposition", "attachment; filename=" + "REPORT.CSV");

5) By doing this...the control goes to the browser and I am not able to enable the button again once the download completes...

Can anybody please help me out .....
[ August 05, 2007: Message edited by: sanju juhi ]
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I repeat:

Originally posted by Bear Bibeault:
But there is no way to detect when the user saves the file to the disk.



Asking the question over again will not change the answer.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic