Hello again,
I just encountered a strange behavior with XML Schema type binding and empty instance elements. I want to assign date and boolean data types in an XML schema file. When the form is loaded, two text boxes are rendered instead of the expected date picker and checkbox. Now when I enter a date in ISO format or true/false, the field suddenly turns into date picker / checkbox. Removing the date turns the date field into a text field again... Does anyone know how to assign data types to instance elements AND allow empty field values? I want to put as much as possible information into XML Schema and avoid XForms binds... PS: I am using the development build from 2009-10-23 but also tried http://forge.objectweb.org/nightlybuilds/ops/ops/orbeon.war ( 31-Oct-2009 04:06) Cheers, Baschir Here is a example reproducing the behavior: <?xml version="1.0" encoding="utf-8"?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" lang="de"> <head> <title></title> <xf:model> <xsd:schema elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="date" type="xsd:date" /> <xsd:element name="boolean" type="xsd:boolean" /> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> <xf:instance> <data xmlns=""> <date></date> <boolean></boolean> </data> </xf:instance> </xf:model> </head> <body> <xf:input ref="/data/date"> <xf:label>Date:</xf:label> </xf:input> <xf:input ref="/data/boolean"> <xf:label>Boolean:</xf:label> </xf:input> </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 OW2 mailing lists service home page: http://www.ow2.org/wws |
Hello, Try type="xforms:date" |
Thanks for the info. You mean <xforms:bind type="...">? I know it works
this way. I was just suprised, that setting the type in an XML Schema does not have the same effect as the bind directive. ricetrac schrieb: > > Baschir Jaghoori wrote: >> Hello again, >> >> I just encountered a strange behavior with XML Schema type binding and >> empty instance elements. I want to assign date and boolean data types in >> an XML schema file. >> >> When the form is loaded, two text boxes are rendered instead of the >> expected date picker and checkbox. Now when I enter a date in ISO format >> or true/false, the field suddenly turns into date picker / checkbox. >> Removing the date turns the date field into a text field again... >> >> Does anyone know how to assign data types to instance elements AND allow >> empty field values? I want to put as much as possible information into >> XML Schema and avoid XForms binds... >> >> PS: I am using the development build from 2009-10-23 but also tried >> http://forge.objectweb.org/nightlybuilds/ops/ops/orbeon.war ( >> 31-Oct-2009 04:06) >> >> Cheers, >> Baschir >> >> >> Here is a example reproducing the behavior: >> >> <?xml version="1.0" encoding="utf-8"?> >> <html >> xmlns="http://www.w3.org/1999/xhtml" >> xmlns:xf="http://www.w3.org/2002/xforms" >> xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> lang="de"> >> <head> >> <title></title> >> <xf:model> >> <xsd:schema >> elementFormDefault="qualified" >> attributeFormDefault="unqualified"> >> <xsd:element >> name="data"> >> <xsd:complexType> >> <xsd:sequence> >> <xsd:element >> name="date" type="xsd:date" /> >> <xsd:element >> name="boolean" type="xsd:boolean" /> >> </xsd:sequence> >> </xsd:complexType> >> </xsd:element> >> </xsd:schema> >> <xf:instance> >> <data >> xmlns=""> >> <date></date> >> <boolean></boolean> >> </data> >> </xf:instance> >> </xf:model> >> </head> >> <body> >> <xf:input >> ref="/data/date"> >> <xf:label>Date:</xf:label> >> </xf:input> >> <xf:input >> ref="/data/boolean"> >> <xf:label>Boolean:</xf:label> >> </xf:input> >> </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 >> OW2 mailing lists service home page: http://www.ow2.org/wws >> >> > > Hello, > > Try type="xforms:date" > > -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws |
but in your schema you don't use "xforms:date" but "xsd:date".
I think is not the same.
|
Administrator
|
In reply to this post by Baschir Jaghoori
Baschir,
On Mon, Nov 2, 2009 at 9:59 AM, Baschir Jaghoori <[hidden email]> wrote: > I just encountered a strange behavior with XML Schema type binding and empty > instance elements. I want to assign date and boolean data types in an XML > schema file. > > When the form is loaded, two text boxes are rendered instead of the expected > date picker and checkbox. Now when I enter a date in ISO format or > true/false, the field suddenly turns into date picker / checkbox. Removing > the date turns the date field into a text field again... This is happening because the schema validator tells the XForms code about the type of the node only if the node is valid. So when the form is loaded, the XForms code doesn't know <date> contains a date; it just knows that this field is invalid. Then when you enter a date, the validator runs again and then tells the XForms code that this is an xs:date, at which point the XForms engine can switch the appearance of the field to a date picker. Obviously, this is not what you want. But it is unclear if we can even get the validator to tell the XForms code about the type of the node when it is invalid. So in essence, you can't use a schema to influence how the <xforms:input> is rendered (text field, date picker, checkbox); you need to use an <xforms:bind> for that. Of course, you can still use the schema to validate the data. BTW, thank you for the use case you attached. Alex -- Orbeon Forms - Web forms, open-source, for the Enterprise Orbeon's Blog: http://www.orbeon.com/blog/ My Twitter: http://twitter.com/avernet -- 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 OW2 mailing lists service home page: http://www.ow2.org/wws
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |