MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual page 76

Developing web applications with coldfusion
Table of Contents

Advertisement

50
multiple select list is a comma-delimited list of the entries selected by the user. For
example, a multiple select list contains four entries: Training, Marketing, HR, and
Sales. The user selects Marketing and Sales. The value of the form field variable is then
'Marketing', 'Sales'.
Just as you can with checkboxes, you can also query with multiple select lists by
searching a database field that contains either numeric values or string values.
Searching numeric values
For example, suppose you want the user to select departments from a multiple select
box. The query retrieves detailed information on the selected department(s):
Select one or more companies to get more information on:
<SELECT Name="SelectDepts" MULTIPLE>
<OPTION VALUE="1">Training
<OPTION VALUE="2">Marketing
<OPTION VALUE="3">HR
<OPTION VALUE="4">Sales
</SELECT>
<INPUT TYPE="hidden"
NAME="SelectDepts_required"
VALUE="You must select at least one department.">
If the user selected the Marketing and Sales items, the value of the SelectDepts form
field would be 2,4.
If this parameter were used in the following SQL statement:
SELECT *
FROM Departments
WHERE Department_ID IN (#form.SelectDepts#)
the statement sent to the database would be:
SELECT *
FROM Departments
WHERE Department_ID IN (2,4)
Searching string values
Suppose you want the user to select departments from a multiple select list. The
database field search is a string field. The query retrieves detailed information on the
selected department(s):
Select one or more departments to get
more information on:
<SELECT Name="SelectDepts" MULTIPLE>
<OPTION VALUE="'Training'">Training
<OPTION VALUE="'Marketing'">Marketing
<OPTION VALUE="'HR'">HR
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 4.5

Table of Contents