For Adobe ColdFusion application servers Checkbox

A checkbox format field creates a set of checkboxes from a list or query. The checkbox format is the same as radio, except the attribute multiple defaults to Yes (for example, if you specify format="checkbox" multiple="No" then TerraForm will build radio buttons instead of checkboxes).

Note, if you want to use a single checkbox to retrieve a boolean result (e.g. "Yes, send me free offers by email!") use the boolean format and datatype instead.

TerraForm recognises the following special attributes for checkboxes:

  • Group
    Optional, boolean, defaults to false. Group buttons using HTML fieldset and legend tags.
  • Cols
    Optional, defaults to 2. Number of columns in which to display the checkboxes. Set cols=1 for one long column, or cols=0 for one long row.
  • tablePassthrough
    Optional. The checkboxes are presented in a row/column layout using regular table tags. This attribute provides the ability to pass attributes through to the table tag wrapped around the checkboxes. Remember to escape any double quotes (") or hashes / pound signs (#) by doubling them. See the example below.
  • tdPassthrough
    Optional. Attributes to pass through to the td tag wrapped around each individual checkbox. Remember to escape any double quotes (") or hashes / pound signs (#) by doubling them. See the example below.
  • gridstart, gridend, rowstart, rowend, cellstart, cellend (new in 2.5)
    Optional. By default, TerraForm uses a simple table to layout your checkboxes. You can manipulate the layout with tablePassthrough and tdPassthrough or you can take total control by provide your own replacement markup using this set of six attributes. Note: Do not use these attributes in combination with tablePassthrough and tdPassthrough. For a good sample of the utility of these attributes, look at the Multiple-choice survey sample in the downloadable code gallery.

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

  • onMouseOver="click()"
  • disabled
  • style="background-color : ##cccccc; border : 1px solid black; margin-left : 20px"

Examples

A checkbox field built from a query and returning a list of integers:

<cf_terrafield
  name="GameIDList"
  caption="Infocom interactive fiction"
  format="checkbox"
  datatype="IntegerList"
  query="Infocom"
  valuecolumn="GameID"
  displaycolumn="GameName"
  default="6,10"
  cols="3"
  group=true
  tablepassthrough="cellpadding=""5"""
  tdpassthrough="onmouseover=""this.style.color = 'blue'""
    onmouseout=""this.style.color = ''""" 
/>
Infocom interactive fiction

HyperText Markup Language
The coding language used to create hypertext documents for use on the World Wide Web.
No comments yet