User Guide
Creating Dynamic Check Boxes and Multiple-Selection List Boxes 87
Searching 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):
<select name="SelectDepts" multiple>
<option value="Training">Training
<option value="Marketing">Marketing
<option value="HR">HR
<option value="Sales">Sales
</select>
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
ListQualifyfunction with multiple-selection list boxes:
SELECT *
FROM Departmt
WHERE Dept_Name IN (#ListQualify(Form.SelectDepts,"’")#)
The following statement gets sent to the database:
SELECT *
FROM Departmt
WHERE Dept_Name IN (’Marketing’,’Sales’)