The choices element

Release 2.0 - ...

This element is used within selection form controls (the elements select and select1), to group available choices. This provides the same functionality as element optgroup in HTML.

Example

XML CopyCode image Copy Code
<xforms:choices>
   <xforms:item>
      <xforms:label>Vanilla</xforms:label>
      <xforms:value>v</xforms:value>
   </xforms:item>
   <xforms:item>
      <xforms:label>Strawberry</xforms:label>
      <xforms:value>s</xforms:value>
   </xforms:item>
   <xforms:item>
      <xforms:label>Chocolate</xforms:label>
      <xforms:value>c</xforms:value>
   </xforms:item>
</xforms:choices>

Attributes

Name Required / optional Description
Common Attributes optional Any attribute from the Common Attributes collection (e.g. id).

Content

Within an choices element, the following child elements are allowed:

Element Name Required / optional Description
label optional Provides a descriptive label for the containing form control
choices optional Choices element can be nested. However, the html element optgroup can not be nested.
item optional Element to specify the storage value and label to represent an item in a list.
itemset optional Element which allows the creation of dynamic selections.

Specification

Link to the XForms specification: the choices element.