<CFQUERY NAME="myquery"
DATASOURCE="cfsnippets">
SELECT * FROM Employees
</CFQUERY>
<CFFORM NAME="Form1" ACTION="submit.cfm"
METHOD="Post">
<CFSELECT NAME="myselectbox"
QUERY="myquery"
VALUE="Employee_ID"
DISPLAY="FirstName"
REQUIRED="yes"
MULTIPLE="yes"
SIZE="8">
</CFSELECT>
<BR><INPUT TYPE="Submit"
VALUE="Submit">
</CFFORM>
The resulting drop-down list box looks like this:
Note that because the MULTIPLE attribute is used, the user can select multiple entries in the select box. When MULTIPLE is omitted or SINGLE is explicitly used and the SIZE attribute is set to zero, the resulting CFSELECT looks like this:
One other thing to note about this example: since the VALUE tag specifies the primary key for the Employee table, this data is used in the form variable that is passed to the application page specified in ACTION.
|