144
Developing Web Applications with ColdFusion
To populate a drop-down list box with query data using CFSELECT:
1.
Open a new file in Studio.
2.
Modify the file so that it appears as follows:
<CFQUERY NAME="getNames"
DATASOURCE="CompanyInfo">
SELECT * FROM Employees
</CFQUERY>
<CFFORM NAME="Form1" ACTION="submit.cfm"
METHOD="Post">
<CFSELECT NAME="employeeNames"
QUERY="getNames"
VALUE="Employee_ID"
DISPLAY="FirstName"
REQUIRED="yes"
MULTIPLE="yes"
SIZE="8">
</CFSELECT>
<BR><INPUT TYPE="Submit"
VALUE="Submit">
</CFFORM>
3.
Save the file as
selectbox.cfm
and view it in your browser.
Note that because the MULTIPLE attribute is used, the user can select multiple entries
in the select box. Also, because the VALUE tag specifies the primary key for the
Employee table, this data is used in the form variable that is passed to the application
page specified in ACTION.
Embedding Java Applets
The CFAPPLET tag allows you to embed Java applets in a CFFORM. To use CFAPPLET,
you must first register your Java applet using the ColdFusion Administrator Applets
page. In the Administrator, you define the interface to the applet, encapsulating it so
that each invocation of the CFAPPLET tag is very simple.
CFAPPLET offers several advantages over using the HTML APPLET tag:
•
Return values — Since CFAPPLET requires a form field name attribute, you can
avoid having to code additional JavaScript to capture the applet's return values.
You can reference return values like any other ColdFusion form variable:
form.variablename
.
•
Ease of use — Since the applet's interface is defined in the Administrator, each
instance of the CFAPPLET tag in your pages only needs to reference the applet's
name and specify a form variable name.
Содержание COLDFUSION 4.5-DEVELOPING WEB
Страница 1: ...Allaire Corporation Developing Web Applications with ColdFusion ColdFusion 4 5...
Страница 14: ...xiv Developing Web Applications with ColdFusion...
Страница 26: ...xxvi Developing Web Applications with ColdFusion...
Страница 34: ...8 Developing Web Applications with ColdFusion...
Страница 70: ...44 Developing Web Applications with ColdFusion...
Страница 84: ...58 Developing Web Applications with ColdFusion...
Страница 114: ...88 Developing Web Applications with ColdFusion...
Страница 148: ...122 Developing Web Applications with ColdFusion...
Страница 174: ...148 Developing Web Applications with ColdFusion...
Страница 208: ...182 Developing Web Applications with ColdFusion...
Страница 244: ...218 Developing Web Applications with ColdFusion...
Страница 274: ...248 Developing Web Applications with ColdFusion...
Страница 288: ...262 Developing Web Applications with ColdFusion...
Страница 300: ...274 Developing Web Applications with ColdFusion...
Страница 350: ...324 Developing Web Applications with ColdFusion...
Страница 362: ...336 Developing Web Applications with ColdFusion...