Requirement : We need an easy authoring method for tracking the selected case of a switch using a node of data.

It is possible to use an xforms-ready handler and a pile of xforms-select handlers to track the selected case of a switch, except it is not guaranteed to work correctly. For example, if a setvalue or UI binding modifies the data node, there is no way to set a listener for changes to a data node, so the data and the switch case will be out of synch, a difference that is obvious across a save/reload. Therefore, the requirement cannot be met with correctness with XForms today.

To achieve data model drive switching, form authors are therefore strongly inhibited from using switch. Since that is the XForms container control for UI switching, it is a language flaw that must be fixed.

The working group discussed the issue and the following is the result of that initial discussion:

Here is a simple markup example based on the ideas expressed so far:

<select1 ref="/path/to/cart/@phase">

</select1>

<switch ref="/path/to/cart" selected="@phase">

</switch>

The working group also considered the fact that the UI control that drives the case selection is separate from the switch, so the relationship between the two controls is not well-established by the declared UI.

The working group considered the following:

However, there has been some pushback on this part. Also, it seems to go beyond dealing with the immediate requirement. Moreover, in XForms 2.0 there is a requirement for repeat to do a better job of being able to relate other controls that are working with the repeat to accomplish something. Perhaps the same mechanism would be used for switch.

There was also some discussion about the extensibility of this feature to switches that can select multiple cases at the same time. It was agreed that a multi-selection switch might be done with a separate control, but more importantly that it was an XForms 2.0 feature. However, this formulation of "selected" does not conflict with eventually being able to offer multi-case switches.

CategoryXFormsFutureFeatures


CategoryXForms12

Model-based switching with switch (last edited 2009-11-04 21:56:04 by JohnBoyer)