|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
|
|
|
Re: Order of xforms-recalculate and xforms-revalidate eventsHi, Perhaps the XPath 2.0 castable function, so that the calculation is not attempted if the content is not valid. calculate="if ((../value1 castable as xs:integer) and (../value2 castable as xs:integer)) ../value1 * ../value2" (hopefully this code works, if you grep for castable in the source examples, you will see others known to work...) http://www.w3.org/TR/xpath20/#id-castable Cheers, Hank On Jun 26, 2008, at 7:45 AM, Robby Cornelissen wrote: > I'm relatively new to Orbeon and XForms in general, and I'm stumped > by a seemingly simple problem. I've created the following test form: > > <xhtml:html > > > xmlns:xforms="http://www.w3.org/2002/ > xforms" > > xmlns:xhtml="http://www.w3.org/ > 1999/xhtml" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <xhtml:head> > <xhtml:title>Validation-Calculation-Order</xhtml:title> > <xforms:model> > <xforms:instance id="example" > xmlns=""> > > > <example> > > > <value1>10</value1> > <value2>10</ > value2> > > > <value3>100</value3> > </example> > </xforms:instance> > <xforms:bind nodeset="value1" type="xs:integer"/ > > > > <xforms:bind nodeset="value2" > type="xs:integer"/ > > > > <xforms:bind nodeset="value3" > type="xs:integer" calculate="../value1 * ../value2"/> > </xforms:model> > </xhtml:head> > <xhtml:body> > <xforms:input ref="value1"/> > <xforms:input ref="value2"/> > <xforms:output ref="value3"/> > </xhtml:body> > </xhtml:html> > > Basically, the idea is to recalculate value3 whenever the user > changes value1 or value2. The problem is that, if the users enters > a value that is not numeric, I get a 'Failure converting untyped > value "a" to a number' after evaluation of the calculate bind. So > the question is, how can I force revalidation to occur before > recalculation without resorting to xforms:setvalue and the likes? > > Cheers, > > Darth > > -- > You receive this message as a subscriber of the ops-users@... > mailing list. > To unsubscribe: mailto:ops-users-unsubscribe@... > For general help: mailto:sympa@...?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws NEES@UCSB Institute for Crustal Studies, University of California, Santa Barbara 805-893-8042 -- You receive this message as a subscriber of the ops-users@... mailing list. To unsubscribe: mailto:ops-users-unsubscribe@... For general help: mailto:sympa@...?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
|
|
Re: Re: Order of xforms-recalculate and xforms-revalidate eventsYes, that's the idea. A little annoying but I am not sure there is a
better way to avoid conversion errors at the moment. However I don't think we should propagate dynamic JS errors to the client the way we do now. We need to check this. The issue is that w/ XForms/XPath 1.0, this can't really happen, but in XPath 2.0 more dynamic errors can happen. I entered an RFE to track this: http://tinyurl.com/6luw7s Regarding forcing a revalidation, I am not sure this will help. What did you have in mind? -Erik On Jun 26, 2008, at 8:21 AM, Hank Ratzesberger wrote: > > Hi, > > Perhaps the XPath 2.0 castable function, so that the calculation is > not > attempted if the content is not valid. > > calculate="if ((../value1 castable as xs:integer) and (../value2 > castable as xs:integer)) > ../value1 * ../value2" > > (hopefully this code works, if you grep for castable in the source > examples, you will > see others known to work...) > > http://www.w3.org/TR/xpath20/#id-castable > > Cheers, > Hank > > On Jun 26, 2008, at 7:45 AM, Robby Cornelissen wrote: > >> I'm relatively new to Orbeon and XForms in general, and I'm stumped >> by a seemingly simple problem. I've created the following test form: >> >> < >> xhtml:html >> xmlns:xforms >> ="http://www.w3.org/2002/ >> xforms >> " xmlns:xhtml >> ="http://www.w3.org/1999/xhtml" >> xmlns:xs="http://www.w3.org/2001/XMLSchema"> >> <xhtml:head> >> <xhtml:title>Validation-Calculation-Order</xhtml:title> >> <xforms:model> >> <xforms:instance id="example" >> xmlns >> = >> ""> >> < >> example >> > >> < >> value1>10</value1> >> <value2>10</ >> value2 >> > >> < >> value3>100</value3> >> </example> >> </xforms:instance> >> <xforms:bind nodeset="value1" type="xs:integer"/ >> > >> < >> xforms:bind nodeset="value2" type="xs:integer"/ >> > >> < >> xforms:bind nodeset="value3" type="xs:integer" calculate="../value1 >> * ../value2"/> >> </xforms:model> >> </xhtml:head> >> <xhtml:body> >> <xforms:input ref="value1"/> >> <xforms:input ref="value2"/> >> <xforms:output ref="value3"/> >> </xhtml:body> >> </xhtml:html> >> >> Basically, the idea is to recalculate value3 whenever the user >> changes value1 or value2. The problem is that, if the users enters >> a value that is not numeric, I get a 'Failure converting untyped >> value "a" to a number' after evaluation of the calculate bind. So >> the question is, how can I force revalidation to occur before >> recalculation without resorting to xforms:setvalue and the likes? >> >> Cheers, >> >> Darth Orbeon Forms - Web Forms for the Enterprise Done the Right Way http://www.orbeon.com/ -- You receive this message as a subscriber of the ops-users@... mailing list. To unsubscribe: mailto:ops-users-unsubscribe@... For general help: mailto:sympa@...?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
|
|
Re: Re: Re: Order of xforms-recalculate and xforms-revalidate eventsI'll go with the castable check for now. Like I said, I'm pretty knew to XForms, so I'm not really sure what I had in mind. I've written a couple of form frameworks in Javascript in the past, and in those I checked data types and constraints before attempting calculations. In the Orbeon docs, I found something about an xxforms:computed-binds="revalidate" MIP which sounded pretty much like what I was looking for, but didn't do the trick.
Thanks for the effort and the great work, and I'll hope to be able to provide more substantial input when I get the hang of things. Darth On Thu, Jun 26, 2008 at 07:50:00PM -0700, Erik Bruchez wrote: > Yes, that's the idea. A little annoying but I am not sure there is a > better way to avoid conversion errors at the moment. > > However I don't think we should propagate dynamic JS errors to the > client the way we do now. We need to check this. The issue is that w/ > XForms/XPath 1.0, this can't really happen, but in XPath 2.0 more > dynamic errors can happen. I entered an RFE to track this: > > http://tinyurl.com/6luw7s > > Regarding forcing a revalidation, I am not sure this will help. What > did you have in mind? > > -Erik > > On Jun 26, 2008, at 8:21 AM, Hank Ratzesberger wrote: > > > > >Hi, > > > >Perhaps the XPath 2.0 castable function, so that the calculation is > >not > >attempted if the content is not valid. > > > > calculate="if ((../value1 castable as xs:integer) and (../value2 > >castable as xs:integer)) > > ../value1 * ../value2" > > > >(hopefully this code works, if you grep for castable in the source > >examples, you will > >see others known to work...) > > > >http://www.w3.org/TR/xpath20/#id-castable > > > >Cheers, > >Hank > > > >On Jun 26, 2008, at 7:45 AM, Robby Cornelissen wrote: > > > >>I'm relatively new to Orbeon and XForms in general, and I'm stumped > >>by a seemingly simple problem. I've created the following test form: > >> > >>< > >>xhtml:html > >> xmlns:xforms ="http://www.w3.org/2002/ > >>xforms > >>" > >>xmlns:xhtml ="http://www.w3.org/1999/xhtml" > >> xmlns:xs="http://www.w3.org/2001/XMLSchema"> > >> <xhtml:head> > >> <xhtml:title>Validation-Calculation-Order</xhtml:title> > >> <xforms:model> > >> <xforms:instance id="example" > >>xmlns > >>= > >>""> > >> < example > >>> > >> < value1>10</value1> > >> <value2>10</ > >>value2 > >>> > >> < value3>100</value3> > >> </example> > >> </xforms:instance> > >> <xforms:bind nodeset="value1" type="xs:integer"/ > >>> > >> < xforms:bind nodeset="value2" type="xs:integer"/ > >>> > >> < xforms:bind nodeset="value3" type="xs:integer" calculate="../value1 > >>* ../value2"/> > >> </xforms:model> > >> </xhtml:head> > >> <xhtml:body> > >> <xforms:input ref="value1"/> > >> <xforms:input ref="value2"/> > >> <xforms:output ref="value3"/> > >> </xhtml:body> > >></xhtml:html> > >> > >>Basically, the idea is to recalculate value3 whenever the user > >>changes value1 or value2. The problem is that, if the users enters > >>a value that is not numeric, I get a 'Failure converting untyped > >>value "a" to a number' after evaluation of the calculate bind. So > >>the question is, how can I force revalidation to occur before > >>recalculation without resorting to xforms:setvalue and the likes? > >> > >>Cheers, > >> > >>Darth > > -- > Orbeon Forms - Web Forms for the Enterprise Done the Right Way > http://www.orbeon.com/ > > > -- > You receive this message as a subscriber of the ops-users@... mailing list. > To unsubscribe: mailto:ops-users-unsubscribe@... > For general help: mailto:sympa@...?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws -- You receive this message as a subscriber of the ops-users@... mailing list. To unsubscribe: mailto:ops-users-unsubscribe@... For general help: mailto:sympa@...?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
| Free Forum Powered by Nabble | Forum Help |