MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual page 74

Developing web applications with coldfusion
Table of Contents

Advertisement

48
Searching numeric values
Suppose you want a user to select one or more departments using checkboxes. You
query the database to retrieve detailed information on the selected department(s).
Select one or more departments to get information on:
<INPUT TYPE="checkbox"
NAME="SelectedDept"
VALUE="1">
Training<BR>
<INPUT TYPE="checkbox"
NAME="SelectedDept"
VALUE="2">
Marketing<BR>
<INPUT TYPE="checkbox"
NAME="SelectedDept"
VALUE="3">
HR<BR>
<INPUT TYPE="checkbox"
NAME="SelectedDept"
VALUE="4">
Sales<BR>
<INPUT TYPE="hidden"
NAME="SelectedDepts_required"
VALUE="You must select at least one organization.">
The text displayed to the user is the name of the department, but the VALUE attribute
of each checkbox corresponds to the underlying database primary key for the
department's record.
If the user checked the Marketing and Sales items, the value of the SelectedDept form
field would be "2,4." If this parameter were used, the following would be the resulting
SQL statement:
SELECT *
FROM Departments
WHERE Department_ID IN ( #form.SelectedDept# )
The statement sent to the database would be:
SELECT *
FROM Departments
WHERE Department_ID IN ( 2,4 )
Searching string values
To search for a database field containing string values (instead of numeric), you must
modify both the checkbox and CFQUERY syntax.
Developing Web Applications with ColdFusion

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents