validating groups of fields

Let's say I have the following instance data:

<data>
  <field1>
  <field2>
  <field3>
  <field4>
  <field5>
  <field6>
</data>

And I have the corresponding 6 bindings for each field, declared as integers.

Say I want to constrain the form to enforce that fields 1, 2 & 3 sum
to less than 100. That's easy enough to do with a binding with this
constraint:

<xforms:bind id="group-bind" constraint="field1 + field2 + field3 < 100"/>

I can then attach a group to this bind, stick the input controls for
the first 3 controls inside it, and have a helpful alert displayed
around all three controls when they sum to 100 or more:

<xforms:group bind="group-bind">
  <xforms:input bind="bind-field1">... </xforms:input>
  <xforms:input bind="bind-field2">... </xforms:input>
  <xforms:input bind="bind-field3">... </xforms:input>
</xforms:bind>

Great! Except, what do I specify as the nodeset for group-bind? In
this case there isn't a node to connect the group binding to. As a
workaround I can create a separate instance data document with a dummy
node to point group-bind to, but this certainly doesn't seem ideal.

And assume the schema is fixed, so changing the instance data
structure to introduce a dummy wrapping node around fields 1-3 is not
an option (and the node is totally redundant outside the form anyway).

The XForms schema implies that nodeset is optional, but the XForms
implementation I'm using (Chiba) doesn't really support this usefully
(it just defaults to the outermost node - data, which means ALL fields
get flagged as invalid - no good).

So, is nodeset genuinely optional and just not being supported
correctly by Chiba? If not, how should this situation be approached in
XForms?

Adrian

Received on Tuesday, 13 September 2005 04:26:14 UTC