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

10.4. 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-4, in which two CFTEXTINPUT tags are used to solicit information from a user.

Example 10-4. 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:  #MyName#<BR>
  PhoneNumber: #PhoneNumber#
  </CFOUTPUT>
  <HR NOSHADE>
</CFIF>

<CFFORM ACTION="Example10-4.cfm" 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 Number:</TD>
  <TD><CFTEXTINPUT NAME="PhoneNumber" VALUE="xxx-xxx-xxxx" 
                   ALIGN="ABSMIDDLE" HEIGHT="25" WIDTH="100" 
                   BGCOLOR="##C0C0C0" FONT="Arial" FONTSIZE="14" BOLD="Yes" 
                   ITALIC="Yes" TEXTCOLOR="##000000" MAXLENGTH="12"
                   REQUIRED="Yes" VALIDATE="telephone"  
                   MESSAGE="You must enter your phone number as xxx-xxx-xxxx">
  </TD>
</TR>
<TR>
  <TD COLSPAN="2"><INPUT TYPE="submit" NAME="Submit" VALUE="Submit"></TD>
</TR>
</TABLE>
</CFFORM>

					  


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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