For Adobe ColdFusion application servers Numeric

A numeric format field is similar to a text field but designed for numeric data, with right-alignment, and key filtering depending on the datatype.

One special attribute is available for numeric:

  • AutoAdvanceTo
    Optional. If you have maxlength set for this field, you can command TerraForm to move focus to the next field when this one is full. Set AutoAdvanceTo to the name of the next field. A good use for this is where several fields are used to collect the same piece of data, such as a credit card or social security number. (Note that for this type of data it is recommended that you use a string datatype as any numeric datatype will translate 0000 into 0 and 0472 into 472. See the example below.)

Other non-TerraField attributes will be passed through to the underlying text tag (<input type="text">). For example:

  • style="border : 0 dotted #666666; border-width : 0 0 1px 0"
  • accesskey="N"
  • tabindex="6"
  • size="10"

The form below shows examples of a plain field, a field with a real datatype, a field with a price datatype, and a field with a range of a allowed values.

Examples

A plain numeric field (the default datatype is integer):

<cf_terrafield
  name="MyNumericField1"
  format="numeric"
/>

A numeric field with a real value:

<cf_terrafield
  name="MyNumericField2"
  format="numeric"
  datatype="real"
  default="#Pi()#"
/>

A numeric field with a price:

<cf_terrafield
  name="MyNumericField3"
  format="numeric"
  datatype="price"
  default="$1.50"
  size="6"
/>

A numeric field with a range of allowed values:

<cf_terrafield
  name="Passengers"
  caption="Number of passengers"
  format="numeric"
  size="3"
  min="0"
  max="999"
/>

Using AutoAdvanceTo:

 
<cf_terrafield
  name="cc1"
  caption="credit card number"
  format="numeric"
  datatype="string"
  required="true"
  size="4"
  maxlength="4"
  autoadvanceto="cc2"
  pattern="[0-9]{4}"
  jsmask="/[0-9]/"
  error="Your credit card number is 16 digits. Please enter 4 digits in each field. No spaces or other characters please!"   
/>
<cf_terrafield
  name="cc2"
  caption="credit card number"
  format="numeric"
  datatype="string"
  required="true"
  size="4"
  maxlength="4"
  autoadvanceto="cc3"
  pattern="[0-9]{4}"
  jsmask="/[0-9]/"
  error="Your credit card number is 16 digits. Please enter 4 digits in each field. No spaces or other characters please!"   
/>
<cf_terrafield
  name="cc3"
  caption="credit card number"
  format="numeric"
  datatype="string"
  required="true"
  size="4"
  maxlength="4"
  autoadvanceto="cc4"
  pattern="[0-9]{4}"
  jsmask="/[0-9]/"
  error="Your credit card number is 16 digits. Please enter 4 digits in each field. No spaces or other characters please!"  
/>
<cf_terrafield
  name="cc4"
  caption="credit card number"
  format="numeric"
  datatype="string"
  required="true"
  size="4"
  maxlength="4"
  pattern="[0-9]{4}"
  jsmask="/[0-9]/"
  error="Your credit card number is 16 digits. Please enter 4 digits in each field. No spaces or other characters please!" 
/>

 *  *  *  *

Fields marked with  * are required.

No comments yet