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

6.1.8 Configuring a list box

To add/delete/modify a list 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 <select-values> element and set the cardinality attribute to "one".
  4. A <select-values> element with cardinality="many" uses the (multi-select) List Box.

  5. Set the <select-value> element to specify what items should appear in the list that can be selected. Set the api-value to specify how the value is interpreted and display-value to determine what is displayed in the list.
  6. Optional: Set the <default> element within <select-values> to select a value other than the first one in the list as the default.
  7. Optional: Set the sort attribute of <select-values> to "true" to sort the values alphabetically by their <display-value> rather than by the order they are listed in the XML.
<component id=”os” required=”true”>
  <description>Operating Systems</description>
  <select-values cardinality="one" sort=”true”>
    <select-value api-value="RhelAS4u6x86_64" display-value="RedHat AS 4.6 64bit" />
    <select-value api-value="RhelAS4u6x86" display-value="RedHat AS 4.6 32bit" />
    <select-value api-value="RhelES5u1x86_64" display-value="RedHat ES 5.1 64bit" />
    <default api-value="RhelAS4u6x86" display-value="RedHat AS 4.6 32bit" />
    <select-value api-value="Win2003EEr2x86" display-value="Win 2003 Ent 32bit" />
    <select-value api-value="Win2003EEr2x86_64" display-value="Win 2003 Ent 64bit" />
    <select-value api-value="RhelES5u1x86" display-value="RedHat ES 5.1 32bit" />
  </select-values>
</component>

All validation and rule descriptors use the api-value attribute when getting the value of a single select list box.

Related topics