The CFTEXTINPUT form custom control allows you to place a single-line text entry box in a CFFORM. In addition to input validation, the tag gives you control over all font characteristics.
Note | CFTEXTINPUT incorporates a Java applet, so a browser must be Java- enabled for CFTEXTINPUT to work properly. |
<CFTEXTINPUT NAME="name" VALUE="text" REQUIRED="Yes/No" RANGE="min_value, max_value" VALIDATE="data_type" ONVALIDATE="script_name" MESSAGE="text" ONERROR="text" SIZE="integer" FONT="font_name" FONTSIZE="integer" ITALIC="Yes/No" BOLD="Yes/No" HEIGHT="integer" WIDTH="integer" VSPACE="integer" HSPACE="integer" ALIGN="alignment" BGCOLOR="color" TEXTCOLOR="color" MAXLENGTH="integer" NOTSUPPORTED="text">
Required. A name for the CFTEXTINPUT control.
Optional. Initial value that appears in the text control.
Optional. Yes or No. If Yes, the user must enter or change text. Default is No.
Optional. Enter a minimum value, maximum value range separated by a comma. Valid only for numeric data.
Optional. Valid entries are:
Optional. The name of a valid JavaScript function used to validate user input. The form object, input object, and input object value are passed to the specified routine, which should return TRUE if validation succeeds and FALSE otherwise. When used, the VALIDATE attribute is ignored.
Optional. Message text to appear if validation fails.
Optional. The name of a valid JavaScript function you want to execute in the event of a failed validation.
Optional. Number of characters displayed before horizontal scroll bar appears.
Optional. Font name for text.
Optional. Font size for text.
Optional. Enter Yes for italicized text, No for normal text. Default is No.
Optional. Enter Yes for boldface text, No for medium text. Default is No.
Optional. Height value of the control, in pixels.
Optional. Width value of the control, in pixels.
Optional. Vertical spacing of the control, in pixels.
Optional. Horizontal spacing of the control, in pixels.
Optional. Alignment value. Valid entries are:
Optional. Background color of the control. Valid entries are:
A hex value can also be entered in the form:
BGCOLOR="##xxxxxx"
Where x is 0-9 or A-F. Use either two pound signs or no pound signs.
Optional. Text color for the control. See BGCOLOR for color options.
Optional. The maximum length of text entered.
Optional. The text you want to display if the page containing a Java applet-based CFFORM control is opened by a browser that does not support Java or has Java support disabled. For example:
NOTSUPPORTED="<B> Browser must support Java to view ColdFusion Java Applets</B>"
By default, if no message is specified, the following message appears:
<B>Browser must support Java to <BR> view ColdFusion Java Applets!</B>
<!--- This example shows the use of CFTEXTINPUT ---> <HTML> <HEAD> <TITLE> CFTEXTINPUT Example </TITLE> </HEAD> <BODY bgcolor=silver> <H3>CFTEXTINPUT Example</H3> CFTEXTINPUT can be used to provide simple validation for text fields in CFFORM and to have control over font information displayed in CFFORM input boxes for text. For example, the field provided below must not be blank, and provides a client-side message upon erring. <CFFORM ACTION="cftextinput.cfm" METHOD="POST" ENABLECAB="Yes"> <CFIF IsDefined("form.myInput")> <H3>You entered <CFOUTPUT>#form.myInput#</CFOUTPUT> into the text box </H3> </CFIF> <CFTEXTINPUT NAME="myInput" FONT="Courier" FONTSIZE=12 VALUE="Look, this text is red!" TEXTCOLOR="FF0000" MESSAGE="This field must not be blank" REQUIRED="Yes"> <INPUT TYPE="Submit" NAME="" VALUE="submit"> </CFFORM> </BODY> </HTML>