Creating or configuring forms > Configuring the <components> element > Configuring a date box

6.1.3 Configuring a date box

A date box allows users to input a date value. Restrictions can be placed on the date box to define what are valid dates. As with other components, the default date can be specified by using the <default> element.

To add/delete/modify a date box

  1. Open the appropriate XML file located in the Viewpoint home directory. Locate the <components> element.
  2. Create the <component> with a unique id.
  3. Set the <date-value> element within <component>.
  4. Set restrictions to define which dates are valid. To do so:
    1. Insert the <earliest-date> element within <date-value> to specify the earliest date that a user can input. This is assumed to be an absolute date, but to set it as a relative date, add the relative attribute, and set it to "false".
    2. Set the date by inserting any of all of the following elements: <years>, <months>, <days>, <hours>, <minutes>, and <seconds>. The text in each of these elements must be an integer value. Any value not set is assumed to be 0.
    3. Users may specify values above the theoretical maximum and they will be converted. For example, 25 hours would correspond to +1 day and 1 hour.

    4. Insert the <latest-date> element within <date-value> to specify the latest date that a user can input. This is assumed to be an absolute date, but to set it as a relative date, add the relative attribute and set it to "true". Set the date according to the instructions in step 4b.
    <component id="birthday" required="true">
      <description>Birthday</description>
      <date-value>
        <earliest-date relative="false">
          <years>1776</years>
          <months>7</months>
          <days>4</days>
        </earliest-date>
        <latest-date relative="true" />
      </date-value>
    </component>
    The user must input a date after July 4, 1776 and before today.

Related topics