You are reading O'Reilly XForms Essentials by Micah Dubinko. (What is this?) - Buy XForms Essentials Online


Groups make possible a number of conveniences, but also have a functional aspect. In nearly every respect, a group is another kind of form control, and thus model item properties such as relevant and required can apply to a group, and override those properties on any contained form controls. This is most useful when an entire section of a form needs to change based on some condition in the instance data. The switch element can provide similar functionality, though only based on explicit events to toggle one of several alternatives into view. The group approach works better when the dynamic behavior desired relates directly to the instance data.

Groups can also help authors with a couple of shortcuts:

<xforms:group ref="my:Envelope/my:ExcessivelyNestedElement">
  <xforms:input ref="my:Leaf">