For Adobe ColdFusion application servers TimeSpanPicker

TimeSpanPicker is a composite field comprising several HTML fields that work together to collect a timespan or length of time, i.e. a number of days, hours, minutes, and seconds. The timeSpanPicker format is not intended to represent a time of day. The values are combined into the base unit, which defaults to days. For example, if a user specifies 6 hours, then the resulting value is 0.25, representing one quarter of a day. If the base unit is hours, then the resulting value will be 6.

The default datatype for TimeSpanPicker is real.

The following special attributes are available for TimeSpanPicker:

  • baseUnit
    Optional. The units of time span used for the input and output values. Possible values are: "d", "h", "n", "s" representing days, hours minutes, seconds respectively. Defaults to days ("d"). Note the symbol for minutes is "n", corresponding to the symbol used in the ColdFusion dateFormat() function.
  • days, hours, minutes, seconds
    Optional. Toggle the display of each selector column? True or false. Defaults to false, true, true, false respectively.
  • daysMax, hoursMax, minutesMax, secondsMax
    Optional. The maximum number of each unit to allow. Defaults to 99, 99, 59, 59 respectively.
  • daysPrompt, hoursPrompt, minutesPrompt, secondsPrompt
    Optional. Prompt for each column of numbers. Defaults to "D", "H", "M", and "S" respectively.

Other non-TerraField attributes will be passed through to the underlying select box tags (<select>).

When this composite field is submitted with valid data, several fields will become available. Depending on the format of the picker, these may not all become available (e.g. [name]_seconds won't be available if the seconds attribute is set to false). They are (where [name] represents the name of the field):

  • [name]
    The full timespan chosen - a real number.
  • [name]_days
    The days component chosen.
  • [name]_hours
    The hours component chosen.
  • [name]_minutes
    The minutes component.
  • [name]_seconds
    The seconds component.

Examples

A basic picker:

<cf_terrafield
  name="timespan1"
  format="timespanpicker"
/>
:

A full picker:

<cf_terrafield
  name="timespan2"
  format="timespanpicker"
  days
  seconds
/>
: : :

The following pickers have different base units (the first is days and the second is hours). So while the default values appear to be the same, they represent different amounts of time. 1.234 days is 29 hours, 36 minutes. 1.234 hours is 1 hour, 14 minutes.

<cf_terrafield
  name="timespan3"
  format="timespanpicker"
  default="1.234"
/>
<cf_terrafield
  name="timespan4"
  format="timespanpicker"
  default="1.234"
  baseUnit="h"
/>
:


:

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