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

10. Dynamic Form Controls > 10.3. Textual Input

Textual Input

The cftextinput tag offers a Java control for accepting basic text input. Although it provides the same basic functionality as the cfinput and HTML input tags, cftextinput differs in that it allows you to specify a number of attributes affecting the look of both the text box and the data entered into it. Consider Example 10-5, in which two cftextinput tags are used to solicit information from a user.

Example 10-5. Creating a form using cfform and cftextinput
<!--- Check to see if form field data is being passed and if so, display it --->
<cfif IsDefined('form.Fieldnames')>
  <h3>You submitted:</h3>
  <cfoutput>
  MyName:  #form.MyName#<br>
  PhoneNumber: #form.PhoneNumber#
  </cfoutput>
  <hr noshade>
</cfif>
   
<cfform action="#CGI.Script_Name#" enablecab="Yes" name="MyForm" 
        enctype="application/x-www-form-urlencoded">
<table>
<tr>
  <td>Name:</td>
  <td><cftextinput name="MyName" align="AbsMiddle" 
                   height="25" width="250" bgcolor="##C0C0C0"
                   font="Arial" fontsize="14" bold="Yes" italic="No"
                   textcolor="##000000" maxlength="255" required="Yes"
                   message="You must enter your name"></td>
</tr>
<tr>
  <td>Phone Num....

PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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