Using Wddx; Using The Cfwddx Tag; Validating Wddx Data; Using Javascript Objects - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Using WDDX

The following sections describe how you can use WDDX in ColdFusion applications. The first
two sections describe the tools that ColdFusion provides for creating and converting WDDX.
The remaining sections show how you use these tools for common application uses.

Using the cfwddx tag

The
tag can do the following conversions:
cfwddx
From
CFML
CFML
WDDX
WDDX
A typical
cfwddx
<cfwddx action="cfml2wddx" input="#MyQueryObject#" output="WddxTextVariable">
In this example, MyQueryObject is the name of the query object variable, and WddxTextVariable
is the name of the variable in which to store the resulting WDDX XML. Note
For more information on the

Validating WDDX data

The
tag has a
cfwddx
JavaScript. When you set this attribute to True, the XML parser uses the WDDX DTD to
validate the WDDX data before deserializing it. If the WDDX is not valid, ColdFusion generates
an error. By default, ColdFusion does not validate WDDX data before trying to convert it to
ColdFusion or JavaScript data.
The
function returns True if a variable is a valid WDDX data packet. It returns False
IsWDDX
otherwise. You can use this function to validate WDDX packets before converting them to
another format. For example, you can use it instead of the
invalid WDDX is handled within conditional logic instead of error-handling code. You can also
use it to pre-validate data that will be deserialized by JavaScript at the browser.

Using JavaScript objects

ColdFusion provides two JavaScript objects,
, that you can use in JavaScript to convert data to WDDX. These objects are defined in
object
the file webroot/cfide/scripts/wddx.js.
CFML Reference describes these objects and their methods in detail. The example
data from the browser to the server" on page 703
JavaScript to WDDX.
702
Chapter 31: Using XML and WDDX
To
WDDX
JavaScript
CFML
JavaScript
tag used to convert a CFML query object to WDDX looks like the following:
tag, see CFML Reference.
cfwddx
attribute that you can use when converting WDDX to CFML or
Validate
cfwddx validate
WddxSerializer object
shows how you can use these objects to serialize
attribute, so that
and
WddxRecordset
"Transferring

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents