XForms/Select and Group

Motivation
You want to conditionally display a group of elements based on the value selected from a list. This will work similar to a "switch/case" but you can have each view depend on complex XPath expressions that will evaluated to either true or false.

Screen Image


In the screen image above, the second item is selected. When a different item is selected, the view under the select list changes.

Sample Program
      Select View:   One one   Two</xf:label> <xf:value>two</xf:value> </xf:item> <xf:item> <xf:label>Three</xf:label> <xf:value>three</xf:value> </xf:item> </xf:select1> <xf:output ref="view-1"> <xf:label>Current view: </xf:label> </xf:output> <xf:output ref="view-2"> <xf:label>Current view: </xf:label> </xf:output> <xf:output ref="view-3"> <xf:label>Current view: </xf:label> </xf:output> <xf:group ref="view-1"> <xf:label>View One</xf:label> One One One One One One One One One One One One One One One One One One </xf:group> <xf:group ref="view-2"> <xf:label>View Two</xf:label> Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two Two </xf:group> <xf:group ref="view-3"> <xf:label>View Three</xf:label> Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three Three </xf:group>

Discussion
This program is very similar to the example that uses a button to toggle a switch/case but the value is calculated dynamically by any XPath expression. The prior example that uses switch/case/toggle uses an XML Event to make a specific case visible.