Skip to main content
Participant
January 26, 2012
Question

CFProgressBar not working with CFFlush

  • January 26, 2012
  • 2 replies
  • 1340 views

I am having a difficult time trying to get my CFProgressBar to appear on the screen before the page completes.  I must be doing something wrong, but I am able to get plain old JavaScript (using innerHtml text) to appear and update through my loop, but when I replace my innerHtml code with the CFProgressBar text, Firebug tells me that the progress bar cannot be found.

Can anyone shed some light on this for me?

Here is working code with innerHtml:

<p id="loading">Starting....</p>

<CFFLUSH>

<CFLOOP FROM="1" TO="50" index="i">

     <SCRIPT LANGUAGE="JavaScript">

            document.getElementById('loading').innerHTML = '<CFOUTPUT>#i# out of 50 complete</CFOUTPUT>';

     </SCRIPT>

     <CFFLUSH>

</CFLOOP>

Here is the Progress bar code that does not work:

<head>

<script>

    function showBar()

    {

        ColdFusion.ProgressBar.show( "cbsProgressBar" );

        ColdFusion.ProgressBar.start( "cbsProgressBar" );

    }

</script>

</head>

<p id="progressBar">

<cfprogressbar name="cbsProgressBar" autoDisplay="true" width="200" duration="1000" > 

</p>

<CFFLUSH>

<SCRIPT>

    showBar();          <!--- this gives an error b/c it doesn't see the progress bar ... WHY????  --->

</SCRIPT>

<CFFLUSH>

<CFLOOP FROM="1" TO="50" index="i">

     <SCRIPT LANGUAGE="JavaScript">

          ColdFusion.ProgressBar.updateStatus("cbsProgressBar","Updating...",<CFOUTPUT>#i#</CFOUTPUT>/50);

     </SCRIPT>

     <CFFLUSH>

</CFLOOP>

This topic has been closed for replies.

2 replies

cfjedimaster
Inspiring
June 12, 2012

I'm not surprised this wont' work. When you use <cfprogressbar>, it isn't _immediately_ creating it - but rather "preparing" it to be inserted into the DOM. Basically - you can't do what you want to do here - have one request that cfflushes out and moves a progress bar.

Participant
January 26, 2012

By the way, Firebug reports this error:

uncaught exception: ColdFusion.ProgressBar: ProgressBar  config object not found for id: cbsProgressBar