• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 10. Dynamic Form Controls > A Selection Control

10.5. A Selection Control

The CFSELECT tag extends the functionality provided by the HTML SELECT tag by including data validation as well as a mechanism for quickly and easily building dynamic drop-down boxes from query results. Example 10-5 shows a simple use of CFSELECT with static option values.

Example 10-5. Using CFSELECT with Static Option Values

<CFIF IsDefined('Form.Selectbox')>
  <CFOUTPUT>You submitted <B>#Form.Selectbox#</B>.</CFOUTPUT>
  <HR NOSHADE>
</CFIF>

<CFFORM ACTION="Example10-5.cfm" ENABLECAB="Yes" NAME="MyForm" 
ENCTYPE="application/x-www-form-urlencoded">

<CFSELECT NAME="Selectbox" SIZE="5" 
          MESSAGE="You must select at least one item from the selection box." 
          REQUIRED="Yes" MULTIPLE="Yes">
   <OPTION VALUE="January">January
   <OPTION VALUE="February">February
   <OPTION VALUE="March">March
   <OPTION VALUE="April">April
   <OPTION VALUE="May">May
   <OPTION VALUE="June">June
   <OPTION VALUE="July">July
   <OPTION VALUE="August">August
   <OPTION VALUE="September">September
   <OPTION VALUE="October">October
   <OPTION VALUE="November">November
   <OPTION VALUE="December">December
</CFSELECT>
<P>    
<INPUT TYPE="submit" NAME="Submit" VALUE="Submit Form">               
</CFFORM>

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint