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

6.1.4 Configuring a duration spinner

You can configure the <duration-value> component to display number spinners. You can specify how many spinners should be available for entering time information.

To add/delete/modify a duration spinner

  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 “spinner”.
  4. Set the <default> element within <duration-value> to define a default value for each period type.
  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 the <display> element within <duration-value> to specify which number displays for each period type.
  8. 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>, and <seconds>. The text in each of these elements must be an integer value. Any value not set is assumed to be 0.
  9. 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="spinner">   <!-- Type should be "text" or "spinner".  -->
      <default>                <!-- You can specify a default value for any     -->
        <time-period>          <!-- period type listed above.                   -->
          <days>14</days>      <!-- Here, a default value of 14 is displayed    -->
          <hours>6</hours>     <!-- to the user for the 'days' entry and '6' is -->
        </time-period>         <!-- displayed for the 'hours' entry.            -->
      </default>
      <minimum>                <!-- Minimum and maximum values can be specified -->
        <time-period>          <!-- for each period type.                       -->
          <hours>4</hours>
        </time-period>
      </minimum>
      <maximum>
        <time-period>
          <years>2</years>
        </time-period>
      </maximum>
      <display>                <!-- This works for only the "spinner" duration  -->
        <time-period>          <!-- type. Using this element creates a spinner  -->
          <months>1</months>   <!-- for each time period that you specify. A    -->
          <days>1</days>       <!-- time period with a value of '1' displays a  -->
          <hours>1</hours>     <!-- number spinner for that time period type on -->
        </time-period>         <!-- the GUI.                                    -->
      </display>
    </duration-value>

Related topics