User Guide

Table Of Contents
630 Chapter 26: Introduction to Retrieving and Formatting Data
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
department(s), 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
ListQualify function with multiple-selection list boxes:
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')