cftextinput

Description

Lets you place a single-line text entry box in a cfform. The tag also gives you control over font characteristics.

Category

Forms tags

Syntax


<cftextinput name = "name"

  value = "text"

  required = "Yes" or "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" or "No"

  bold = "Yes" or "No"

  height = "integer"

  width = "integer"

  vSpace = "integer"

  hSpace = "integer"

  align = "alignment"

  bgColor = "color"

  textColor = "color"

  maxLength = "integer"

  notSupported = "text"> 

See also

cfapplet, cfinput, cfform, cfselect, cfgrid, cfslider, cfgridcolumn, cfgridrow, cftree, cfgridupdate, cftreeitem

Attributes

Attribute
Description
name
Required. A name for the cftextinput control.
value
Optional. Initial value that displays in the text control.
required
Optional. Yes or No. If Yes, the user must enter or change text. Default is No.
range
Optional. 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 JavaScript function used to validate user input. The form object, input object, and input object value are passed to the routine, which should return TRUE if validation succeeds and FALSE otherwise. When used, the validate attribute is ignored.
message
Optional. Message text to display if validation fails.
onError
Optional. Name of a JavaScript function to execute in the event of a failed validation.
size
Optional. Number of characters displayed before horizontal scroll bar displays.
font
Optional. Font name for text.
fontSize
Optional. Font size for text.
italic
Optional. Yes for italicized text, No for normal text. Default is No.
bold
Optional. 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 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 displays:

<B>Browser must support Java to <BR> 

view ColdFusion Java Applets!</B> 

Usage


Note

cftextinput requires the client to download a Java applet. Downloading an applet takes time; therefore, using cftextinput might be slightly slower than using an HTML form element to retrieve the same information. In addition, browsers must be Java-enabled for cftextinput to work properly.


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>    



Banner.Novgorod.Ru