The case element
Release 2.0 - ...
This element encloses markup to be conditionally rendered. The content elements (e.g. form controls, groups, switches, repeats and host language elements) within a non-selected case behave as if they were in a non-relevant group. Similarly, content elements in a case that becomes selected behave as if they were in a group that has become relevant. The attribute selected determines the initial selected state.
If multiple cases within a switch are marked as selected="true", the first selected case remains and all others are deselected. If none are selected, the first becomes selected.
Example
XML | Copy Code |
---|---|
<xf:case id="in" selected="true"> <xf:input ref="yourname"> <xf:label>Please tell me your name</xf:label> </xf:input> <xf:trigger> <xf:label>Submit</xf:label> <xf:toggle ev:event="DOMActivate" case="out"/> </xf:trigger> </xf:case> |
Attributes
Name | Required / optional | Description |
---|---|---|
selected | optional | Selection status for the case. Legal values: true or false. The default value is false. |
Common Attributes | optional | Any attribute from the Common Attributes collection (e.g. id). |
Content
Within an case element, the following child elements are allowed:
Element Name | Required / optional | Description |
---|---|---|
label | optional | Provides a descriptive label for the entire group. |
Core Form Controls | optional | Any element from the Core Form Controls group. |
Container Form Controls | optional | Any element from the Container Form Controls group. |
Action Elements | optional | Any element from the Action Elements group. |
Specification
Link to the XForms specification: the case element.