User Guide
Chapter 5: Making Variables Dynamic 47
4 </SELECT>
<!-- radio buttons -->
<P>
Department:<BR>
<INPUT TYPE="radio" name="Department" value="Training">Training<BR>
<INPUT TYPE="radio" name="Department" value="Sales">Sales<BR>
<INPUT TYPE="radio" name="Department" value="Marketing">Marketing<BR>
</P>
<!-- check box -->
<P>
Contractor? <input type="checkbox" name="Contractor" value="Yes"
checked>Yes
</P>
<!-- reset button -->
<INPUT TYPE="reset" NAME="ResetForm" VALUE="Clear Form">
<!-- submit button -->
<INPUT TYPE="submit" NAME="SubmitForm" VALUE="Submit">
</FORM>
</BODY>
</HTML>
3. Save the page as formpage.cfm.
4. View
formpage.cfm in a browser.
The changes that you just made appear in the form.
Remember that you need an action page to submit values.
Creating Dynamic Checkboxes and Multiple Select Boxes
When an HTML form contains either a list of checkboxes with the same name or a
multiple select box, the user’s entries are made available as a comma-delimited list
with the selected values. These lists can be very useful for a wide range of inputs.
Note If no value is entered for a checkbox or multiple select lists, no variable is
created.The SQL INSERT statement will not work correctly if there are no
values. To correct this problem, make the form fields required, use
Dynamic SQL, or use CFPARAM to establish a default value for the form
field..
Checkboxes
When you put a series of checkboxes with the same name in an HTML form, the
variable that is created contains a comma-delimited list of values. The values can be
either numeric values or alphanumeric strings. These two types of values are treated
slightly differently.