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

RE: Validate 2 fieds!

From: John Boyer <JBoyer@PureEdge.com>
Date: Tue, 26 Oct 2004 09:22:14 -0700
Message-ID: <7874BFCCD289A645B5CE3935769F0B52C723F7@tigger.pureedge.com>
To: "Vo, Thanh Chi" <ThanhVo@psv.com.vn>, <www-forms@w3.org>
Schema doesn't do dynamic constraints like that, so you have to use the xforms constraint model item property, e.g.
    <data xmlns="">
<bind nodeset="a" constraint=". &lt; ../b" />
<input ref="a"><label>Enter a:</label></input>
<input ref="b"><label>Enter b:</label></input>
The nodeset binds to a node named 'a' in the data node.  The constraint then says that that node ('a' is referenced by .) 
must be less than (&lt;) the sibling of 'a' named 'b' (.. means go to the parent 'data' of the context node 'a', then choose 
the child named 'b').
Finally, as an aside, note that I keep saying *the* node 'a' or *the* node 'b'.  Technically, XPath will bind to *all* nodes 
that have the given name, so you have to be a little careful when you write your XPath expressions to make sure that 
they match a single node when you need them to do so.  In this example, we can plainly see that there is only one a 
and only one b, so it is safe to write XPaths that will match all a's and all b's because we see in the data that only one 
node will be matched each time.
Best regards,
John Boyer, Ph.D.
Senior Product Architect and Research Scientist
PureEdge Solutions Inc.

-----Original Message-----
From: Vo, Thanh Chi [mailto:ThanhVo@psv.com.vn]
Sent: Monday, October 25, 2004 11:16 PM
To: 'www-forms@w3.org'
Subject: Validate 2 fieds!

Hi all,
Could you tell me how to make a validation like that:
value A < value B.
By schema I've just make value A, value B in a fix range( such as 0..255)
And by schema could we make a constrain like that( value A < value B).
Received on Tuesday, 26 October 2004 16:22:50 UTC

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