Whatever message this page gives is out now! Go check it out!
<cfprogressbar
autoDisplay="true|false"
name="control identifier"
bind ="bind expression"
duration="time value"
height="height in pixels"
interval="time in milliseconds"
onComplete="function name"
onError="JavaScript function name"
style="style specification"
width="pixel value" >Attribute | Req/Opt | Default | Description |
autoDisplay | Optional | true | Set to true to display the progress bar. |
name | Required | The control name. Used to refer to the control in JavaScript, for example in the script that starts the progress. | |
bind | Required if duration is not specified | A bind expression specifying a client JavaScript function or server CFC that the control calls to get progress information each time the period defined by the interval attribute elapses. You cannot use this attribute with a duration attribute. If an error occurs, no further bind expression calls are triggered and onError is called (if defined). | |
duration | Required if bind is not specified | The time, in milliseconds, between when the bar starts showing progress and when it shows completed progress. Use only on automatic progress bars that do not use a bind expression to get actual progress information. You cannot use this attribute with a bind attribute. | |
height | Optional | Height of the bar in pixels. | |
interval | Optional | 1000 | Used if duration is specified. The time interval, in milliseconds, at which the progress bar updates. Although this attribute is optional, specify it to prevent the bar from updating frequently. |
onComplete | Optional | The name of a function to call when progress completes. | |
onError | Applies only if you use bind. The JavaScript function to run on an error condition. The error can be a network error or server-side error. | ||
style | Optional | The following are the supported colors:
| |
width | Optional | 400 | The width (length) of the bar in pixels. |
ColdFusion.ProgressBar.start(barName)
ColdFusion.ProgressBar.stop(barName)<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<script type="text/javascript">
// The function that starts the progress bar,
// called when the user clicks the Send comment button.
function startProgress() {
ColdFusion.ProgressBar.start("mydataProgressbar");
};
// The function called when the progress bar finishes,
// specified by the cfprogressbar tag onComplete attribute.
function onfinish() {
alert("Done");
};
</script>
<body>
<!--- Ensure there is no Session.STATUS value, which is used by
the progress bar bind CFC, when the page displays. --->
<cfif IsDefined("Session.STATUS")>
<cfscript>
StructDelete(Session,"STATUS");
</cfscript>
</cfif>
<!--- For code simplicity, formatting is minimal. --->
<cfform name="kitform">
<p>To make our service better and to benefit from our special offers,
take a moment to give us your email address and send us a comment.</p>
<p>Name:<br />
<cfinput type="text" name="name"> </p>
<p>E-mail:<br />
<cfinput type="text" name="email"> </p>
<p>Comment:<br />
<cftextarea name="cmnt"/></p>
<p>
<cfinput type="button" name="" value="Send Comment"
onClick=startProgress()></p>
<!--- The progressbar control --->
<div style="padding-left:3px" >
<cfprogressbar name="mydataProgressbar"
bind="cfc:mycfc.getstatus()"
interval="1700"
width="200"
oncomplete="onfinish"/>
</div>
</cfform>
</body>
</html><cfcomponent>
<!--- This function simulates the time taken
by and operation by using sleep functions.
It increments the progressbar status by 1/10 each time the
progressbar bind expression calls it (that is, each time the
time specified by the cfprogressbar interval attribute passes.
--->
<cffunction name="getstatus" access="remote">
<cfset str = StructNew()>
<cfset str.message = "Saving Data">
<cfif NOT IsDefined("session.STATUS")>
<cfset session.STATUS = 0.1>
<cfscript>
Sleep(200);
</cfscript>
<cfelseif session.STATUS LT 0.9>
<cfset session.STATUS=session.STATUS + .1>
<cfscript>
Sleep(200);
</cfscript>
<cfelse>
<cfset str.message = "Done...">
<cfset session.STATUS="1.0">
</cfif>
<cfset str.status = session.STATUS>
<cfreturn str>
</cffunction>
</cfcomponent>