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

10. Dynamic Form Controls > 10.4. A Selection Control

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-6 shows a simple use of cfselect with static option values.

Example 10-6. Using cfselect with static option values
<cfif IsDefined('form.Selectbox')>
  <cfoutput>You submitted <b>#form.Selectbox#</b>.</cfoutput>
  <hr noshade>
</cfif>
   
<cfform action="#CGI.Script_Name#" 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>
   <option value="February">February</option>
   <option value="March">March</option>
   <option value="April">April</option>
   <option value="May">May</option>
   <option value="June">June</option>
   <option value="July">July</option>
   <option value="August">August</option>
   <option value="September">September</optio....

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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