Please note, this is a STATIC archive of website developer.mozilla.org from November 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

XForms Select Element

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 open and closed, default is closed.
    • incremental - supported, default value is true

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 choices element isn't implemented
  • if incremental attribute value is false, the bound node is updated when the select control 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

  • appearance attribute contains the value full
  • there are no analogue widgets in XHTML or in XUL
  • visual grouping by choices element is supported
  • if incremental attribute value is false then bound node is updated when item is 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>

Document Tags and Contributors

Tags: 
 Contributors to this page: Sheppy, Surkov.alexander
 Last updated by: Sheppy,