RE: Validate 2 fieds!

Hi,
 
Schema doesn't do dynamic constraints like that, so you have to use the xforms constraint model item property, e.g.
 
<model>
 
<instance>
    <data xmlns="">
        <a>5</a>
        <b>10</b>
    </data>
</instance>
 
<bind nodeset="a" constraint=". &lt; ../b" />
 
</model>
 
<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