The <CFINPUT> Tag

<CFINPUT> is a cousin to the standard HTML form tag <INPUT>. Depending on the parameters used with it, the tag can be used to collect user input in the form of a text box, radio buttons, a check box, or a password box.

One of the primary advantages to using <CFINPUT> instead of its HTML counterpart is that it can also validate user input—that is, it can examine the text a user types in and see if it matches a certain format, such as a five-digit ZIP code or a nine-digit Social Security number. If the match fails, the user is advised to check her entry and resubmit.

Say that a client has asked me to design a simple online poll to determine how its users feel about crime. The envisioned page will look something like Figure 11.2 ...

Get Sams Teach Yourself ColdFusion® in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.