Loading message in CF?

if a page is loading ie, post post back from, running a query, is they a way in CF that can inform the user the page is loading ie message: page is loading.

i can do this will javascript examples i have found, but is not a real loading message in terms of actually check if the page is loading, most our just timers etc, i want only the message to be displayed when a page is doing something ie loading.

many thanks
LVL 12
Who is Participating?
bwasyliukConnect With a Mentor Commented:
I have used javascript extensively myself to fool the user into waiting while something completes, check out this example here:


Even though this is not tied to the page completing in any way - since something is moving, users sit patiently waiting.  The method we have used to implement this is to have the forms post to a very small (quick loading) page, which just takes all the form data and reposts it to the actual destination where processing will be done.

<form name="myform" method="get" action="inc_progress.cfm">
  <!--- form contents here --->

On the "inc_progress.cfm" page, there is a set of code like this:

      <form name="generalform" action="<cfoutput>#url.page_get#</cfoutput>" method="get">
      <cfloop index="curr_field" list="#StructKeyList(url)#">
      <input type="hidden" name="<cfoutput>#curr_field#</cfoutput>" value="<cfoutput>#evaluate("url."&curr_field)#</cfoutput>" />
        window.onload = document.generalform.submit();

In addition, you include whatever javascript you want to have the scrolling progress bar or other text displayed.

So, the load of the "inc_progress.cfm" page is very fast - and it shows the progress bar while the form posts/gets to the server for the processing (which may take a few seconds/moments).

I have seen some examples where people used cfflush to indicate actual progress in the query or processing that is done, but I have never been able to make cfflush work the way I want (I call stored procedures for all database queries) so I cant provide much more background on the cfflush option.

Let me know if you want me to elaborate on any of the above.
73SpyderConnect With a Mentor Commented:
We use a JS method.

In a .js file we have this:

// Initialize scripting
window.onload = function () {
      document.getElementById('waitwarn').style.display = 'none';

If the cf file we have this.

      <div id="waitwarn" class="red_message" style="display:block;">
      Please wait while the report generates...

This is the most effective solution we have used.
pigmentartsAuthor Commented:
if i am runn a simple query this would not run?
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

Could be.  We only use this on pages that we know could take a long time to run.  
pigmentartsAuthor Commented:
i dont really want to force the user to wait if they dont have to, that would pee me off, but thanks for the example
This particular method has worked well for me since the form on the "inc_progress.cfm" page submits immediately on page load.  So if the processing is fast on form handle page, the progress bar is only displayed for a split second and then they are off to the results page.

There is really no waiting if they dont have to.  The wait is entirely dependent on the speed of the form processing on the form handle page.
I agree with bwasyliuk.  Our status bar is only up for a short time with a short query.

pigmentartsAuthor Commented:
ok makes sense, will have a go now. many thanks for your help guys
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.