Pages

Sunday, April 27, 2014

How to Use Checkboxes in ColdFusion

ColdFusion check boxes give you the ability to display several form answers from which your users can choose. Check boxes are an alternative to a drop-down menu. You can control how many answers a user can choose with a check box, so webmasters use ColdFusion check boxes instead of drop-down boxes to make the code more convenient to control user input when processing the form.

Instructions

    1

    Right-click the ColdFusion file you want to use to create the check boxes and click "Open With." Click your ColdFusion editor in the list of programs.

    2

    Add the check box control. You use standard HTML to display a check box. The following code shows a check box named "newsletter" on the ColdFusion page:

    Would you like to receive our newsletter?

    3

    Create the ColdFusion code to determine if the user checked the box. The following code sets up a variable for "true" or "false" depending on the check box value:





    In this example, if the newsletter check box is checked, the variable is set to "true." If it is not, the check box value is set to false. You use this code to sign up the user to a newsletter and save the value in a file or database table.

0 comments:

Post a Comment