Hi Everyone,

I have a CGI script that takes input from the enduser, processes the request and shows the output to the user. The script takes a bit long to finish. As of now user can see only the process symbol until the request is completely processed.

To keep the user stick to the same page I'd like to add a progress bar that should let the user know of what's happening at the webserver like what's is the task being done, how long it will take to finish processing the request and showing the progress in a horizontal bar filling with a color gradually ...

I've tried using Javascript, HTML and CGI::ProgressBar perl module to do this. But, these didn't work the way I wanted.

Can you please guide me how to achieve this?

Here is how my script looks like:

--------------------------------------------------------
#!/usr/bin/perl use strict; use warnings; use CGI; require 'myroutines.pl'; # other required routines here ... ... my $cgi = new CGI; my $JSCRIPT=<<EOF; // JS functions to validate user input ... ... EOF print $cgi->header(); print $cgi->start_html(-Title=>'myTitle', -script=>$JSCRIPT); ## code here ## if( $cgi->param('submit') { my $output1 = & subRoutine1(arg1,arg2..); ... ... my $output2 = & subRoutine2(arg1,arg2,arg3..); ... ... ### I've used several subroutines ### showing the output to the user } else { ### code to show form fields the user has to fill in } print $cgi->end_html;
---------------------------------------------------------

Please let me know if anything needs to be clarified.

Thank you all in advance.

Regards,
Ashwin.

In reply to how to add progress bar to the CGI script by ashwin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.