Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 858

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
<cfcomponent>
<cffunction name="resetStatus" access="remote">
<!---
Clear count from session so that next time the progress bar runs from the start
time.
--->
<cfif session.count gte 10>
<cfset structdelete(session,"count")>
</cfif>
</cffunction>
<cffunction name="getProgessData" access="remote">
<!--- use a count to track progress --->
<cfif not isdefined('session.count')>
<cfset session.count = 1>
<cfelse>
<cfset session.count = session.count + 1 >
</cfif>
<!--- struct with status and message components of the progressbar --->
<cfset data = {status=session.count * 0.1,message=(session.count * 10)
<cfreturn data>
</cffunction>
</cfcomponent>
The following CFM code explains how to use the URL bind expression:
<head>
<script>
var init = function()
{
document.getElementById('cfpbLabel').style.display = 'block';
ColdFusion.ProgressBar.show('pBar');
ColdFusion.ProgressBar.start('pBar');
}
var hideProgessBar = function()
{
document.getElementById('cfpbLabel').style.display = 'none';
ColdFusion.ProgressBar.hide('pBar');
}
</script>
</head>
<cfform>
<div id="cfpbLabel" style="display:none">
Saving File:
</div>
<cfprogressbar
name="pBar"
autodisplay=false
bind="url:progressdata.cfm"
onComplete="hideProgessBar"
width="400">
<cfset ajaxOnLoad('init')>
</cfform>
The following is the Progressdata.cfm:
Last updated 1/20/2012
853
& "%"}>

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents