Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 820

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
The callback handler can be useful to provide information about a successful navigation operation. For example,
you could make a pod's title bar italic to indicate loading (just before the navigate call), and use the callback handler
to switch it back to normal once the navigate completes. Similarly, if a pod is showing pages from a book, the
callback handler could update a page number in a separate field once a page loads
• You can use the special controlName
controls. For example, you can use the controlName
cfwindow
For
and
cfpod
cfwindow
control.
These different techniques provide you with flexibility in writing your code. For example, the
function and the controlName
technique, you make explicit Ajax requests to get markup for the body, and the JavaScript functions in the retrieved
markup might not work properly.
controlName
technique to simpler use cases.
_body
The following example shows how you can use various techniques to change container contents. It consists of a main
page and a second windowsource.cfm page with text that appears in a main page window when you click a button. The
main page has a
control, two
cfpod
• The "Simple navigate" button calls a
window.
• The "Change w2 body & title" button replaces the second window's body and title innerHTML values directly to
specific strings.
• The "Change pod body" button changes the pod body innerHTML to the value of the second window's title
innerHTML.
The following example shows the main page:
<html>
<head>
<!--- Callback handler puts text in the window.cfm callback div block. --->
<script language="javascript">
var mycallBack = function(){
document.getElementById("callback").innerHTML = "<br><br>
<b>This is printed by the callback handler.</b>";
}
<!--- The error handler pops an alert with the error code and message. --->
var myerrorHandler = function(errorCode,errorMessage){
alert("[In Error Handler]" + "\n\n" + "Error Code: " + errorCode + "\n\n" +
"Error Message: " + errorMessage);
}
</script>
</head>
<body>
<cfpod height="50" width="200" title="The Title" name="theTitle">
This is a cfpod control.
</cfpod><br>
<!--- Clicking the link runs a ColdFusion.navigate function that replaces the second window's
contents with windowsource.cfm. The callback handler then updates the window
contents further. --->
<cfwindow name="w1" title="CF Window 1" initShow=true
x=10 y=200 width="200">
variable to access and change the body contents for
_body
tags, you can also use the controlName
variable provide similar functionality. However, with the controlName
_body
ColdFusion.navigate
controls, and the following buttons:
cfwindow
ColdFusion.navigate
Last updated 1/20/2012
property to set the body HTML.
_body.innerHTML
to get or set the title bar contents of the
_title
takes care of these issues. Therefore, limit use of the
function to change the contents of the second
815
and
cfpod
ColdFuson.navigate
_body

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents