W3C home > Mailing lists > Public > www-forms@w3.org > February 2006

RE: server-side validation: relevance

From: Mark Birbeck <mark.birbeck@x-port.net>
Date: Wed, 15 Feb 2006 11:16:14 -0000
To: <www-forms@w3.org>
Message-ID: <018601c63221$3bfc2e10$0e01a8c0@Jan>

Aaron/Jay,

I think the question is about trying to use the same rules on the server as
on the client. When the data comes to the server, how does Jay's server know
whether it is valid or not? If there is no 'something' element, it could
either have been mistakenly omitted, or correctly omitted because 'else' is
not 4. (Jay's business processes may be such that he can't just assume that
the XForms processor only ever sends valid data back, or that no-one can
send data from other applications.)

Jay's solution is to run the same test that the XForms processor did, to
find out whether or not there should be a 'something' element. But his
problem is that he can't find the element to do the test on! The element he
needs to test to see if it is 4 is addressed like this:

  something/../else

So if there is no 'something' element, he has no way to find the 'else'
element.

All I can say is good question, and perhaps suggest that you use absolute
paths. Not ideal, I know, but it is a consequence of having @nodeset set the
evaluation context for the MIPs.

Regards,

Mark


Mark Birbeck
CEO
x-port.net Ltd.

e: Mark.Birbeck@x-port.net
t: +44 (0) 20 7689 9232
b: http://internet-apps.blogspot.com/
w: http://www.formsPlayer.com/

Download our XForms processor from
http://www.formsPlayer.com/

> -----Original Message-----
> From: www-forms-request@w3.org 
> [mailto:www-forms-request@w3.org] On Behalf Of Aaron Reed
> Sent: 14 February 2006 23:49
> To: www-forms@w3.org
> Subject: Re: server-side validation: relevance
> 
> 
> Jay Knight wrote:
> 
> > I'm playing arround with validating xforms submission on the 
> > server.... and this question came up.... How can I tell if 
> something 
> > was supposed to be relevant on submission?  Consider this simple 
> > example.
> > 
> > <model>
> >     <instance>
> >         <things>
> >             <something />
> >             <else />
> >         </things>
> >     </instance>
> >     <bind nodeset="something" relevant="../else = 4" />
> >     <submission action="..." method="post" /> </model>
> > 
> > .... snip ...
> > 
> > <input ref="something"><label>Something</label></input>
> > <input ref="else"><label>Else</label></input>
> > 
> > And two possible (valid) submitted instances are:
> > 
> > <things>
> >     <something>blah</something>
> >     <else>4</else>
> > </things>
> > 
> > 
> > <things>
> >     <else>3</else>
> > </things>
> > 
> > (Pease excuse any errors... I haven't actually tested this 
> one out :)
> > 
> > The idea is that "something" should only be relevant if the 
> value of 
> > 'else' is 4.  The problem is that "../else = 4" is a relative xpath 
> > expression whose context node is /things/something, which 
> in the case 
> > of the second submission is not present.  Therfore, I 
> cannot evaluate 
> > that xpath expression meaningfully (so it seems).
> > 
> > Any ideas?
> > 
> > Jay K
> > 
> > 
> > 
> 
> I guess that I don't get what you are asking.  Irrelevant 
> data nodes are not submitted by an xform 
> (http://www.w3.org/TR/2005/PER-xforms-20051006/index-all.html#
> submit). 
> Any node in a submission that reaches the server will be relevant.
> 
> 
> 
> 
Received on Wednesday, 15 February 2006 11:17:21 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Saturday, 10 March 2012 06:22:03 GMT