Hi everybody, thanks allot for help!
Some posts ago Eric sends a new hello4 example (xforms ng). I get it working with orbeon 3 beta 3 without any problems. ;-) I added an attribute age to initial-instance.xml. Ok. Then I wrote a schema.xsd with <element name="age" type="integer"/> for validation. I have tried to use this schema with <xforms:model schema="oxf:/example/schema.xsd">. It seems to work. There comes up a mark until I write an integer to the input field of age. But now the "next" button is not working anymore. Please, can anybody show an easy example how to use schema for validation with xforms ng? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Another Question: Is there a better way for validation as schema?
This is the source for the example initial-instance.xml <myform> <action /> <first-name /> <age /> </myform> ------------------------------------------------ schema.xsd <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="myform"> <xs:complexType> <xs:sequence> <xs:element name="action" type="xs:string" /> <xs:element name="first-name" type="xs:string" /> <xs:element name="age" type="xs:int" /> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> ------------------------------------------------- page-flow.xml: <config xmlns="http://www.orbeon.com/oxf/controller" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xu="http://www.xmldb.org/xupdate" xmlns:oxf="http://www.orbeon.com/oxf/processors"> <page id="ask-name" path-info="/tutorial-hello4" default-submission="initial-instance.xml" view="ask-name-view.xhtml"> <action when="/myform/action = 'next'"> <result page="display-name" transform="oxf:xslt"> <myform xmlns="" xsl:version="2.0"> <action /> <first-name> <xsl:value-of select="doc('input:instance')/myform/first-name" /> </first-name> <age> <xsl:value-of select="doc('input:instance')/myform/age" /> </age> </myform> </result> </action> </page> <page id="display-name" path-info="/tutorial-hello4/display-name" view="display-name-view.xhtml" /> <epilogue url="oxf:/config/epilogue.xpl" /> </config> -------------------------------------------------------- ask-name-view.xhtml: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude"> <head> <title>Hello World Page Flow</title> <xforms:model schema="oxf:/hello4/schema.xsd"> <xforms:instance> <xi:include href="input:instance" /> </xforms:instance> <xforms:submission id="main" ref="/" method="post" action="/tutorial-hello4" /> </xforms:model> </head> <body> <p>Please enter your first name: <xforms:input ref="first-name" /> <br /> Please enter your age: <xforms:input ref="age" /> <xforms:trigger> <xforms:label>Greet Me!</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="action">next</xforms:setvalue> <xforms:send submission="main" /> </xforms:action> </xforms:trigger></p> </body> </html> display-name-view.xhtml <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude"> <head> <title>Hello World Page Flow</title> <xforms:model> <xforms:instance> <xi:include href="input:instance"/> </xforms:instance> <xforms:submission id="main" ref="/" method="post" action="/tutorial-hello4/display-name"/> </xforms:model> </head> <body> <p>Hello <xforms:output ref="first-name"/>!</p> <p>You are <xforms:output ref="age"/>!</p> <p> <xforms:trigger> <xforms:label>Back</xforms:label> <xforms:action ev:event="DOMActivate"> <xforms:setvalue ref="action">back</xforms:setvalue> <xforms:send submission="main"/> </xforms:action> </xforms:trigger> </p> </body> </html> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by c.harder
The BizDoc NG example uses XML schema for validation. I recommend you
look at that. -Erik [hidden email] wrote: > Hi everybody, thanks allot for help! > > Some posts ago Eric sends a new hello4 example (xforms ng). I get it working with orbeon 3 beta 3 without any problems. ;-) > I added an attribute age to initial-instance.xml. Ok. > Then I wrote a schema.xsd with <element name="age" type="integer"/> for validation. > I have tried to use this schema with <xforms:model schema="oxf:/example/schema.xsd">. > It seems to work. There comes up a mark until I write an integer to the input field of age. > But now the "next" button is not working anymore. > > Please, can anybody show an easy example how to use schema for validation with xforms ng? -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Administrator
|
In reply to this post by c.harder
It may be more lightweight and portable for now to use contraint or type
binds, e.g. things like: <xforms:bind nodeset="my-element" type="xs:positiveInteger"/> or: <xforms:bind nodeset="my-element" constraint="normalize-space(.) > 0"/> -Erik [hidden email] wrote: > Another Question: Is there a better way for validation as schema? > > This is the source for the example > > initial-instance.xml > <myform> > <action /> > <first-name /> > <age /> > </myform> > ------------------------------------------------ > schema.xsd > <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <xs:element name="myform"> > <xs:complexType> > <xs:sequence> > <xs:element > name="action" > type="xs:string" /> > <xs:element > name="first-name" > type="xs:string" /> > <xs:element > name="age" > type="xs:int" /> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > ------------------------------------------------- > page-flow.xml: > <config > xmlns="http://www.orbeon.com/oxf/controller" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xu="http://www.xmldb.org/xupdate" > xmlns:oxf="http://www.orbeon.com/oxf/processors"> > <page > id="ask-name" > path-info="/tutorial-hello4" > default-submission="initial-instance.xml" > view="ask-name-view.xhtml"> > <action when="/myform/action = 'next'"> > <result > page="display-name" > transform="oxf:xslt"> > <myform > xmlns="" > xsl:version="2.0"> > <action /> > <first-name> > <xsl:value-of select="doc('input:instance')/myform/first-name" /> > </first-name> > <age> > <xsl:value-of select="doc('input:instance')/myform/age" /> > </age> > </myform> > </result> > </action> > </page> > <page > id="display-name" > path-info="/tutorial-hello4/display-name" > view="display-name-view.xhtml" /> > <epilogue url="oxf:/config/epilogue.xpl" /> > </config> > -------------------------------------------------------- > ask-name-view.xhtml: > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xi="http://www.w3.org/2001/XInclude"> > <head> > <title>Hello World Page Flow</title> > <xforms:model schema="oxf:/hello4/schema.xsd"> > <xforms:instance> > <xi:include href="input:instance" /> > </xforms:instance> > <xforms:submission id="main" ref="/" method="post" > action="/tutorial-hello4" /> > </xforms:model> > </head> > <body> > <p>Please enter your first name: <xforms:input ref="first-name" /> <br /> > Please enter your age: <xforms:input ref="age" /> <xforms:trigger> > <xforms:label>Greet Me!</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:setvalue ref="action">next</xforms:setvalue> > <xforms:send submission="main" /> > </xforms:action> > </xforms:trigger></p> > </body> > </html> > > display-name-view.xhtml > <html xmlns="http://www.w3.org/1999/xhtml" > xmlns:xforms="http://www.w3.org/2002/xforms" > xmlns:ev="http://www.w3.org/2001/xml-events" > xmlns:xi="http://www.w3.org/2001/XInclude"> > <head> > <title>Hello World Page Flow</title> > <xforms:model> > <xforms:instance> > <xi:include href="input:instance"/> > </xforms:instance> > <xforms:submission id="main" ref="/" method="post" action="/tutorial-hello4/display-name"/> > </xforms:model> > </head> > <body> > <p>Hello <xforms:output ref="first-name"/>!</p> > <p>You are <xforms:output ref="age"/>!</p> > > <p> > <xforms:trigger> > <xforms:label>Back</xforms:label> > <xforms:action ev:event="DOMActivate"> > <xforms:setvalue ref="action">back</xforms:setvalue> > <xforms:send submission="main"/> > </xforms:action> > </xforms:trigger> > </p> > </body> > </html> -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws |
Free forum by Nabble | Edit this page |