Dynamically add and remove a 'please wait' message to your complex pages
<!--- **************************** --->
<!--- application.cfm --->

<cfapplication name="wait-test"
                    clientmanagement="no"
                    sessionmanagement="no">

<!--- **************************** --->
<!--- wait.cfm --->

<html>
  <head>
    <title>Please Wait Message</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  </head>

  <body>
  <p>
You can use a combination of &lt;cfflush&gt; and javascript to show a message on the screen while processing a large data set (or any other long-running task).</p>
  <!--- use cfflush to display the 'wait' message right away --->
  <cfflush interval="1">
  <!--- show the message saying there will be a delay --->
  <p id="wait" style="color:red; background-color: #CCCCCC; width: 200px; height: 50px;">Please wait while the data is processed.</p>

  <!--- process your long-running query or script (or anything) --->
  <cfset total = 0>
  <cfloop from="1" to="10000" index="i">
    <cfset total = total + 1>
  </cfloop>

  <!--- after the process is done, use javascript to remove the 'wait' message --->
  <script>
    if (document.getElementById) {
          wait.style.display="none";
    }
  </script>
  <!--- now display the result --->
  <p>The total is<cfoutput>#total#</cfoutput>.</p>

  <p>Keep in mind that this may not work if you have a lot of nested tables since ColdFusion can't
return results unless the ending tags can be flushed as well.</p>

  </body>
</html>



All ColdFusion Tutorials By Author: Nathan Miller