# CFTEXTINPUT

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.

### Syntax

    <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">

#### NAME

Required. A name for the CFTEXTINPUT control.

#### VALUE

Optional. Initial value that appears in the text control.

#### REQUIRED

Optional. Yes or No. If Yes, the user must enter or change text. Default is No.

#### RANGE

Optional. Enter a minimum value, maximum value range separated by a comma. Valid only for numeric data.

#### VALIDATE

Optional. Valid entries are:

- date -- Verifies US date entry in the form mm/dd/yy.
- eurodate -- Verifies valid European date entry in the form dd/mm/yyyy.
- time -- Verifies a time entry in the form hh:mm:ss.
- float -- Verifies a floating point entry.
- integer -- Verifies an integer entry.
- telephone -- Verifies a telephone entry. Telephone data must be entered as ###-###-####. The hyphen separator (-) can be replaced with a blank. The area code and exchange must begin with a digit between 1 and 9.
- zipcode -- (U.S. formats only) Number can be a 5-digit or 9-digit zip in the form #####-####. The hyphen separator (-) can be replaced with a blank.
- creditcard -- Blanks and dashes are stripped and the number is verified using the mod10 algorithm.
- social_security_number -- Number must be entered as ###-##-####. The hyphen separator (-) can be replaced with a blank.

#### ONVALIDATE

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.

#### MESSAGE

Optional. Message text to appear if validation fails.

#### ONERROR

Optional. The name of a valid JavaScript function you want to execute in the event of a failed validation.

#### SIZE

Optional. Number of characters displayed before horizontal scroll bar appears.

#### FONT

Optional. Font name for text.

#### FONTSIZE

Optional. Font size for text.

#### ITALIC

Optional. Enter Yes for italicized text, No for normal text. Default is No.

#### BOLD

Optional. Enter Yes for boldface text, No for medium text. Default is No.

#### HEIGHT

Optional. Height value of the control, in pixels.

#### WIDTH

Optional. Width value of the control, in pixels.

#### VSPACE

Optional. Vertical spacing of the control, in pixels.

#### HSPACE

Optional. Horizontal spacing of the control, in pixels.

#### ALIGN

Optional. Alignment value. Valid entries are:

- Top
- Left
- Bottom
- Baseline
- TextTop
- AbsBottom
- Middle
- AbsMiddle
- Right

#### BGCOLOR

Optional. Background color of the control. Valid entries are:

- black
- magenta
- cyan
- orange
- darkgray
- pink
- gray
- white
- lightgray
- yellow

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.

#### TEXTCOLOR

Optional. Text color for the control. See BGCOLOR for color options.

#### MAXLENGTH

Optional. The maximum length of text entered.

#### NOTSUPPORTED

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>

### Example

    <!--- 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>