Building Dynamic Forms With Cfform Tags - Adobe 38043740 - ColdFusion Standard - Mac Development Manual

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

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Requesting and Presenting Information
Select one or departments to get more information on:
<cfselect name="SelectDepts" multiple>
<option value="1">Training
<option value="2">Marketing
<option value="3">HR
<option value="4">Sales
</cfselect>
If the user selects the Marketing and Sales items, the value of the SelectDepts form field is 2,4. If this parameter is used
in the following SQL statement:
SELECT *
FROM Departmt
WHERE Dept_ID IN (#form.SelectDepts#)
The following statement is sent to the database:
SELECT *
FROM Departmt
WHERE Dept_ID IN (2,4)
Handling string values
Suppose you want the user to select departments from a multiple-selection list box. The database search field is a string
field. The query retrieves detailed information on the selected departments, as follows:
<cfselect name="SelectDepts" multiple>
<option value="Training">Training
<option value="Marketing">Marketing
<option value="HR">HR
<option value="Sales">Sales
</cfselect>
If the user selects the Marketing and Sales items, the SelectDepts form field value is Marketing,Sales.
Just as you did when using check boxes to search database fields containing string values, use the ColdFusion
function with multiple-selection list boxes:
ListQualify
SELECT *
FROM Departmt
WHERE Dept_Name IN (#ListQualify(Form.SelectDepts,"'")#)
The following statement is sent to the database:
SELECT *
FROM Departmt
WHERE Dept_Name IN ('Marketing','Sales')

Building Dynamic Forms with cfform Tags

You can use the
tag to create rich, dynamic forms with sophisticated graphical controls, including several Java
cfform
applet or Flash controls. You can use these controls without writing a line of Java or Flash code.
Last updated 1/20/2012
722

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents