Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 746

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Code
<cfelseif Form.employee_grid.rowstatus.action[counter] is "U">
<cfquery name="UpdateExistingEmployee"
datasource="cfdocexamples">
UPDATE Employee
SET
LastName=<cfqueryparam
value="#Form.employee_grid.LastName[counter]#"
CFSQLType="CF_SQL_VARCHAR" >,
Dept_ID=<cfqueryparam
value="#Form.employee_grid.Dept_ID[counter]#"
CFSQLType="CF_SQL_INTEGER" >
WHERE Emp_ID=<cfqueryparam
value="#Form.employee_grid.original.Emp_ID[counter]#"
CFSQLType="CF_SQL_INTEGER">
</cfquery>
<cfelseif Form.employee_grid.rowstatus.action[counter] is "I">
<cfquery name="InsertNewEmployee"
datasource="cfdocexamples">
INSERT into Employee (LastName, Dept_ID)
VALUES (<cfqueryparam
value="#Form.employee_grid.LastName[counter]#"
CFSQLType="CF_SQL_VARCHAR" >,
<cfqueryparam value="#Form.employee_grid.Dept_ID[counter]#"
CFSQLType="CF_SQL_INTEGER" >)
</cfquery>
</cfif>
</cfloop>
</cfif>
Embedding Java applets
The
tag lets you embed Java applets either on a ColdFusion page or in a
cfapplet
tag, first register your Java applet using the ColdFusion Administrator Java Applets page (under Extensions). In the
ColdFusion Administrator, you define the interface to the applet, encapsulating it so that each invocation of the
tag is simple.
cfapplet
The
tag within a form offers several advantages over using the HTML
cfapplet
• Return values: The
cfapplet
JavaScript to capture the applet's return values. You can reference return values like any other ColdFusion form
variable:
variablename.
Form.
• Ease of use: The applet's interface is defined in the ColdFusion Administrator, so each instance of the
tag in your pages only needs to reference the applet name and specify a form variable name.
• Parameter defaults: ColdFusion uses the parameter value pairs that you defined in the ColdFusion Administrator.
You can override these values by specifying parameter value pairs in the
When an applet is registered, you enter just the applet source and the form variable name:
<cfapplet appletsource="Calculator"name="calc_value">
By contrast, with the HTML
a ColdFusion page.
tag requires a form field
tag, you must declare all the applet's parameters every time you want to use it in
applet
Last updated 1/20/2012
Description
Otherwise, if the action is to update a row, generates a
SQL UPDATE query to update the LastName and
Dept_ID fields for the row specified by the Emp_ID
primary table key.
Otherwise, if the action is to insert a row, generates a
SQL INSERT query to insert the employee's last name
and department ID from the grid row into the database.
The INSERT statement assumes that the DBMS
automatically increments the Emp_ID primary key. If
you use the version of the cfdocexamples database that
is provided for UNIX installations, the record is inserted
without an Emp_ID number.
Closes the cfif tag used to select among deleting,
updating, and inserting.
Closes the loop used for each row to be changed.
Closes the
cfif
tag that surrounds all the active code.
cfform
applet
attribute, so you can avoid coding additional
name
tag
cfapplet
tag. To use the
cfapplet
tag:
cfapplet
.
741

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents