Introduction
Allows the user to choose one or more selections from a list of pre-defined items (see the spec). The list of pre-defined items can be specified by either item (see the spec) or itemset (see the spec) elements. You can visually group these pre-defined items by using the choices (see the spec) element to contain them. Note, some representations of the select element do not support visual grouping.
Attributes
- UI Common
- appearance - the value of this attribute gives a hint to the XForms processor as to which type of widget(s) to use to represent this control.
- accesskey - used to specify the keyboard shortcut for focusing this control.
- Single-Node Binding
- Special
- selection - isn't currently supported. This attribute, when set to 'open', allows the user to provide free entry to the list. Possible values are
openandclosed, default isclosed. - incremental - supported, default value is
true
- selection - isn't currently supported. This attribute, when set to 'open', allows the user to provide free entry to the list. Possible values are
Properties
- selection - see corresponding attribute
- incremental - see corresponding attribute
Type restrictions
The select element can be bound to a node containing simple content capable of holding a sequence. The data binding restriction to simple content may be relaxed when an itemset element is used, which allows the available choices to be obtained from an XForms Model. The relaxation happens when the itemset element specifies the item value using a copy (see spec) element. This is because a copy element can be used to add a subtree of nodes underneath the element that the select control is bound to.
Representations
The XForms select element can be represented by the following widgets for the specified appearance attribute values:
- list - default representation (xhtml/xul)
- check group- used when
appearance = 'full'(xhtml/xul)
list
Displaying a listbox is the default representation (xhtml/xul).
Characteristics
- analogous widgets are <html:select size="5" multiple="true"/> and <xul:listbox seltype="multiple"/>
- visual grouping by
choiceselement isn't implemented - if
incrementalattribute value isfalse, the bound node is updated when theselectcontrol is blurred (i.e. loses focus), otherwise it is updated upon item selection
check group
The select is represented as group of checkboxes (xhtml/xul).
Characteristics
-
appearanceattribute contains the valuefull - there are no analogue widgets in XHTML or in XUL
- visual grouping by
choiceselement is supported - if
incrementalattribute value isfalsethen bound node is updated whenitemis blurred
Examples
<xf:model>
<xf:instance>
<data xmlns="">
<values>g</values>
</data>
</xf:instance>
</xf:model>
<xf:select ref="/data/values" appearance="full">
<xf:choices>
<xf:label>Green colors</xf:label>
<xf:item>
<xf:label>Pale green</xf:label>
<xf:value>pg</xf:value>
</xf:item>
<xf:item>
<xf:label>Green</xf:label>
<xf:value>g</xf:value>
</xf:item>
</xf:choices>
<xf:choices>
<xf:label>Red colors</xf:label>
<xf:item>
<xf:label>Red</xf:label>
<xf:value>r</xf:value>
</xf:item>
<xf:item>
<xf:label>Magenta</xf:label>
<xf:value>m</xf:value>
</xf:item>
</xf:choices>
</xforms:select>