For Adobe ColdFusion application servers Boolean

Boolean represents either Yes or No. Boolean will accept synonyms such as True and False, and 1 and 0. Any non-zero number evaluates to Yes. If the form is valid, Boolean always returns either Yes or No — "" evaluates to No, so setting the Required attribute on a Boolean datatype is meaningless. The default format for the Boolean datatype is boolean (which generates a single checkbox), although other options are demonstrated below.

Two special attributes are available for Boolean:

  • YesSynonyms
    Optional. A list of other words that may be used as synonyms for "Yes." For example: "accept,oui". These synonyms are only relevant where the field's format permits freeform data entry, e.g.:
    <cf_terrafield
      name="accept"
      caption="Do you accept the terms and conditions?"
      datatype="boolean"
      format="text"
    />
  • NoSynonyms
    Optional. A list of other words that may be used as synonyms for "No." For example: "decline,non".

Examples

A plain boolean field:

<cf_terrafield
  name="MyBoolean1"
  datatype="boolean"
/>

A boolean field that defaults to Yes:

<cf_terrafield
  name="MyBoolean2"
  datatype="boolean"
  caption="Sign me up"
  default="Yes"
/>

A boolean text field:

<cf_terrafield
  name="MyBoolean3"
  datatype="boolean"
  caption="extra cheese"
  format="text"
  size="5"
/>

Boolean radio buttons:

<cf_terrafield
  name="MyBoolean4"
  datatype="boolean"
  caption="Life is sweet"
  format="radio"
  valuelist="Yes,No"
  group="yes"
/>
Life is sweet

A boolean select box:

<cf_terrafield
  name="MyBoolean5"
  datatype="boolean"
  caption="Life is short"
  format="select"
  valuelist="NO,YES"
/>

No comments yet