W3C home > Mailing lists > Public > www-forms@w3.org > December 2004

RE: Question re bind constraint

From: John Boyer <JBoyer@PureEdge.com>
Date: Tue, 14 Dec 2004 09:34:39 -0800
Message-ID: <7874BFCCD289A645B5CE3935769F0B52D883D6@tigger.pureedge.com>
To: "Chris Picton" <xforms-list@tangent.co.za>, <www-forms@w3.org>

Hi Chris,

I think you will be able to do this more easily in XForms 1.1 due to the addition of the current() function.

Say you have 

in an instance with id="nums"

And you have a default instance with


Now make an <input ref="result">...

Finally, make a constraint

<bind nodeset="result" constraint="not(instance('nums')/number[text()=current()])"/>

There are numerous other use cases that caused us to add current() to be able to achieve this type of table lookup; yours is another good one!  I think at least some of the xforms 1.0 implementations offer current() as an extension function.  So you can use the above as long as your model lists current in the functions attribute, e.g.

<model functions="current">
  the instances and bind above

If your chosen implementation doesn't support this extension, it will report an error when it reads the functions attribute.

John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.

-----Original Message-----
From: Chris Picton [mailto:xforms-list@tangent.co.za]
Sent: Tuesday, December 14, 2004 1:51 AM
To: 'www-forms@w3.org '
Subject: Question re bind constraint

Hi all

I have a form which has two instances.

The first instance is the actual data which is being edited, and the
second is a list of unique numbers.

One of the fields in the form requires a number to be entered, but it
must be different to any of the numbers in the second instance.

Is there any way to enforce this via xforms constraints?

Chris Picton <xforms-list@tangent.co.za>
Tangent Systems
Received on Tuesday, 14 December 2004 17:37:04 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:14 UTC