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

6.1.11 Configuring a number spinner

The number spinner is a text box that allows only numbers with up and down buttons on the side. As the user clicks on either the up or down arrows, the value inside the spinner increments or decrements, depending on which button is clicked.

To add/remove/modify a number 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 <number-value> element and set its type to "int" for integers or "double" for decimal values.
  4. Set the <minimum> element to specify the minimum value, setting a number as the text. Use the inclusive attribute to specify whether the value inside should be inclusive or exclusive. Set the value to "true" or "false". The default is "true". If it is set to "false", the user will not be able to select that value.
  5. Set the <maximum> element to specify the maximum value. Use the inclusive attribute to specify whether the value inside should be inclusive or exclusive. Set the value to "true" or "false". The default is "true". If it is set to "false", the user will not be able to select that value.
  6. Set the <default> element to specify the default value, which is a number within the minimum and maximum ranges.
  7. <component id="duration" required="true">
      <description>Duration in months</description>
      <number-value type="int">
        <default>1</default>
        <minimum inclusive="true">1</minimum>
        <maximum inclusive="true">12</maximum>
      </number-value>
    </component>

    The number spinner ranges from 1 to 12 inclusive with a default value of 1.

Related topics