Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 879

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
}
</script>
</head>
<body>
<!--- The form to display the employee drop-down list and
employee data. --->
<form name="simpleAJAX" method="get">
List of Employees:&nbsp;&nbsp;&nbsp;
<select name="employee" onChange="getEmployeeDetails(this.value)">
<script language="javascript">
getEmployees();
</script>
</select>
<br><br>
<span id="empData"></span>
</form>
</body>
</html>
The following component, which gets the data from the data source, must be in a file named emp.cfc in the
components subdirectory of the application directory. The CFC uses the cfdocexamples data source that is installed
with ColdFusion if you install the documentation.
<cfcomponent>
<cfset this.dsn = "cfdocexamples">
<cffunction name="getEmployees" access="remote" returnFormat="json" output="false">
<cfargument name="empid" required="no" type="string" default="0">
<Cfquery name="qryEmp" datasource="#this.dsn#">
select * from Employees
<cfif empid neq 0>
where Emp_ID = #empid#
</cfif>
</Cfquery>
<cfreturn qryEmp>
</cffunction>
</cfcomponent>
Using Spry with ColdFusion
ColdFusion provides support for mixing native ColdFusion elements and Spry elements in a single application.
• ColdFusion tags use Spry data sets directly in bind expressions. Therefore, a ColdFusion form element, such as
, binds to a field in a dynamic Spry data set, and is updated each time the data set updates, including when
cfinput
the user selects an item in a Spry control or dynamic region that the data set populates.
To bind to a Spry data set, specify the data set name followed by the path to the specific element that you bind to,
by using standard Spry path syntax. For example, if dsFilters is a Spry data set with a name column, the
bind parameter binds to the value of the current row's name column. The bind parameter
{dsFilters.name}
cannot specify an event; the bind expression is re-evaluated each time the selected row in the data set changes. The
following example shows the bind syntax:
<cfinput name="Input1" type="text"
bind="CfC:DataManager.getInData(filter={dsFilters.name})
Last updated 1/20/2012
874

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents