RE: Question re bind constraint

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 
<numbers>
   <number>1</number>
   <number>2</number>
   <number>3</number>
   ...
</numbers>

in an instance with id="nums"

And you have a default instance with

<data>
   <result/>
</data>

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
</model>

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

Cheers,
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?

Regards
Chris
-- 
Chris Picton <xforms-list@tangent.co.za>
Tangent Systems

Received on Tuesday, 14 December 2004 17:37:04 UTC