xforms-optionalAdded by IBM on August 8, 2013 | Version 1 (Original)
|Occurs when a data node that is required (required = true) changes to being optional, or when a data node that is optional changes value and remains optional.
This event is triggered on the XForms control bound to that node.
Available In xforms:input, xforms:output, xforms:range, xforms:secret, xforms:select, xforms:select1, xforms:submit, xforms:textarea, xforms:trigger, xforms:upload
Example This example shows a field item that accepts the first name of the user's spouse. This field is required if they select the "married" radio button in the form. However, if they then select the "single" radio button, the field becomes optional and the xforms-optional event is triggered. In this case, the event triggers the xforms:message action, which tells the user that the spousal information is no longer required.
The following bind sets makes the spouse's name required if the married radio button is selected:
The following code defines the label that displays the first name of the user's spouse:
required="../marital_status = 'married'"/>
<xforms:label>Spouse's First Name:</xforms:label>
level="modal">Spousal data no longer required.</xforms:message>
- The order in which user interface events are processed is indeterminate. This means you cannot rely on them processing in a particular order.