The xforms-select and xforms-deselect events

Release 2.0 - ...

Dispatched in response to: an item in a select, select1, or a case in a switch becoming selected or deselected.

Event Properties

Event Properties Value / Description
Target item or case
Bubbles Yes
Cancelable No
Context Info

To distinguish between the (de)selection of an item in a select control and a case in a switch control, the Smartsite XForms implementation includes the following properties:

  • source-type (string): either "item" or "case".
  • source-id (string): the id of the item or case that was selected or deselected. This value may be Null.

This is a deviation from the W3C specification, which doesn't include any context info for these events.

The default action for this event results in the following:

  • None, notification event only.

Example

XML CopyCode image Copy Code
<xforms:select ref="/selectedCar">
   <xforms:label>Cars</xforms:label>
   <xforms:item>
      <xforms:label>Pinto</xforms:label>
      <xforms:value>pin</xforms:value>
   </xforms:item>
   <!-- you should see select/deselct messages when this item is selected/deselected -->
   <xforms:item>
      <xforms:label>Subaru</xforms:label>
      <xforms:value>sub</xforms:value>
      <xforms:action ev:event="xforms-select">
         <xforms:message level="modal">xforms-select</xforms:message>
      </xforms:action>
      <xforms:action ev:event="xforms-deselect">
         <xforms:message level="modal">xforms-deselect</xforms:message>
      </xforms:action>
    </xforms:item>
</xforms:select>

Specification

Link to the XForms specification: the xforms-select and xforms-deselect events.