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

6.1.5 Configuring a duration text box

The duration text box component is the default duration component and can be specified with type="text".

To add/delete/modify a duration text 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. Insert the <duration-value> child element with the type attribute set to “text”.
  4. Set the <default> element within <duration-value> to define a default value for each period type. The default value is displayed to the user.
  5. Set the <minimum> element within <duration-value> to specify the minimum allowable value for each period type.
  6. Set the <maximum> element within <duration-value> to specify the maximum allowable value for each period type.
  7. Set <time-period> within each of the child elements described in steps 4-6 and specify a time by setting the following elements inside of <time-period>: <years>, <months>, <days>, <hours>, <minutes>, <seconds>. The text in each of these elements must be an integer value. Any value not set is assumed to be 0.

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.

<duration-value type="text">
  <default>
    <time-period>
      <years>1</years>
      <months>1</months>
      <days>0</days>
      <hours>0</hours>
      <minutes>0</minutes>
      <seconds>0</seconds>
    </time-period>
  </default>
  <minimum>
    <time-period>
      <years>0</years>
      <months>0</months>
      <days>0</days>
      <hours>0</hours>
      <minutes>0</minutes>
      <seconds>0</seconds>
    </time-period>
  </minimum>
  <maximum>
    <time-period>
      <years>100</years>
      <months>100</months>
      <days>365</days>
      <hours>24</hours>
      <minutes>60</minutes>
      <seconds>60</seconds>
    </time-period>
  </maximum>
</duration-value>

Related topics