Date:  02/19/2013 11:10:37 PM Msg ID:  004574
From:  Joe Goldsmiith Thread:  004569
Subject:  Re: Progress Bar Conundrum
Thanks for the response. Here is a link to the live test script in question. I have run this script in FireFox, Chrome, and Safari each with the same results. Again, I only want the progress bar to show after the form is submitted going to the request.formcount line in the same script and between the for-next loop.
Script Testing Progress Bar
Thanks for any comments.
Sent by FoxWeb Support on 02/19/2013 07:03:36 PM:
It would be helpful if you provided a runnable sample program, illustrating the problem. You should replace database and web services operations with simple pause calls (WAIT WINDOW "" TIMEOUT x).
FoxWeb Support Team email
Sent by Joe Goldsmiith on 02/19/2013 04:21:27 PM:
Sorry, that's just pseudocode  to show I had used <link> and <script> to bring in the css and js code. I tried to reduce the amount of general script for brevity opting to focus on more important code from the progressbar example.
Sent by FoxWeb Support on 02/19/2013 02:40:45 PM:
I don't understand what the "import" statements are doing in your HTML HEAD section. You need to place the css and js files in your web tree and reference them with <link> and <script> elements, respectively (or incorporate them in your output after reading their contents with FILETOSTR, like in ProgressBarDemo.fwx).
Also, I don't see a BODY element in your HTML. It is recommended that you validate your HTML and JS code with one of the many available validators.
FoxWeb Support Team email
Sent by Joe Goldsmiith on 02/17/2013 10:17:15 PM:
 I incorporated the FoxWeb progress bar into a slow running script that fetches FedEx XML rates. The script runs slowly because FedEx requires a separate call for each service. So far I have 7 services requiring a call each. All the programming is on one page (fedex.fwx) with a form on top with action="fedex.fwx" to re-call the page. Once the script gets to Request.FormCount lower down the page, the progress bar code needs to run but it doesn't until the script reaches the bottom of the page. Needless to say, this is not the intended behavior.
What I need to know is how to have code below FormCount execute and show to screen while the loop for each service runs. I understand that how it would work for whole page loading but wish to start and stop it below Request.FormCount and within a loop. Here is some sample code for consideration.
*** Script File FedEx.fwx
<html xmlns="" lang="en" xml:lang="en">
import progress.css
import progress.js
<FORM METHOD="post" ACTION="FedEx.fwx" name="FedExRateFetch">
     Get information to calculate rate...
 IF Request.FormCount("Submit") > 0
    M.StartTime = SECONDS()
    response.write("<div id='progressOuterDiv'></div>")
    ***Initialize and show the toolbar
    response.write("<script language='JavaScript'>")
    response.write("var progressBar = new cProgressBar();")
    for x = 1 to m.nRowTotal
        M.TotalSteps = m.nRowTotal

       XML To Send FedEx Rate Request...
        XML Fetch Rate Response
        Send Rates To Screen
        response.write("<script language='JavaScript'>UpdateProgressBar(x / M.TotalSteps * 100, 'Completed step ' + Server.ToString(x) + ' of ' + Server.ToString(M.TotalSteps))</script>")
        WAIT '' TIMEOUT .5
      endfor   && loop through all services
<!-- Now hide the toolbar -->
<script language="JavaScript">;</script>
PROCEDURE UpdateProgressBar
* Generates JavaScript code, which calls progressBar.update() method to update
* the progress bar, for example:
* <script language="JavaScript">progressBar.update(47, 'Completed 47% of the process');</script>
    LPARAMETERS PercentComplete, StatusText
    * First of all extend the script timeout by 10 seconds if it will expire in less than 5 seconds
    IF (SECONDS() - StartTime) + 5 >= Server.ScriptTimeout
    IF TYPE('M.StatusText') <> 'C'
        * No status text was specified -- Let ProgressBar code generate the status text
        Response.Write([<script language="JavaScript">progressBar.update(] + Server.ToString(M.PercentComplete) + [);</script>] + CRLF)
        Response.Write([<script language="JavaScript">progressBar.update(] + Server.ToString(M.PercentComplete) + [, '] + M.StatusText + [');</script>] + CRLF)
    * Force output to be sent to browser
Any thoughts from anyone as to how to make the progress bar show up after Request.FormCount and update within the For Next loop?
Thanks much!!!