Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

On my webpage, i have to generate some excel and pdf files but the user has to wait until the file is generated.

the scenario is this: user press a link and waits until the files are generated and displayed as a links on the raports page. how can i 'tell' to the user to wait?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

"Please wait while we process your request" ?

Add "This may take a moment" if you plan on having it take a min. or two.

Even "This may take up to 5 minutes" if there is a possibility it may take that long.

The possibilities are endless, really.

share|improve this answer
    
For the moment, I'll use this approach with PHP flush() function. TY guys –  dole doug Jul 29 '11 at 8:37
add comment

It depends on how long the process takes. Usually you should take one of these approaches:

  1. If it doesn't last that much (maybe something less than a minute), then simply show a message.
  2. If it lasts long, but you don't want to act asynchronously, or you know that user don't care and waits (such as intranet applications' report), then try to make a progress bar, so that user gets a feedback. In the easiest way, you can set a timer for the progress bar to at least mimic progressing.
  3. If it really lasts that long, or user doesn't want to be hold, then simply create another thread and do the lengthy operation asynchronously on that, and then send the results to user's email (you should get that first in profile).
share|improve this answer
    
Good answer, Saeed! –  Falcon Jul 28 '11 at 20:43
    
Generally good advice, but IE7 freezes on postbacks. If supporting this browser, this should be taken into account. AJAX is the only workaround I'm aware of when displaying a message on a POST in IE7. Standard button click > form POST will not work. –  P.Brian.Mackey Jul 28 '11 at 21:15
    
it's less than a minute. It's about 2-3 seconds per file, but sometimes i have to generate 10 or 20 files. I was thinking at something like is used on facebook. Do you know the idea that stays behind that? –  dole doug Jul 29 '11 at 8:35
add comment

Depending on the size and number of the files in question, and the degree to which this would slow down the process, you might want to consider doing a little dynamic page content work to spit out a growing list along the lines of:

Please wait while Website.Com creates the X file(s) you requested
------
Book1.xls generated.
Book2.xls generated.
Document.pdf generated.

Please wait, archiving files...

And then give them the opportunity to download the ZIP (or whatever the end result is meant to be).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.