Administrator
|
All,
Find it here: http://blog.orbeon.com/2010/10/state-of-orbeon-forms-part-9.html Enjoy, -Erik -- 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 |
Hi,
I want to allow integer/date typed elements to be valid even when empty. I am setting the element postalCode to type integer in the schema declaration. <xs:element name="postalCode" type="xs:integer" nillable="true" /> In the model instance I have set the xsi:nil attribute to true. <postalCode xsi:nil="true"/> Also, am using the namespace "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in my document for this purpose. I want that whenever the postalCode element is left empty by the user, xsi:nil="true" is used to pass the xml validation. However, when the postalCode element gets the user input, xsi:nil is either set to "false" or is made irrelevant. I am using the below code for making xsi:nil irrelevant. <xforms:bind nodeset="//@xsi:nil" relevant="count(text())=0"/> Now, when I submit the form with empty postalCode element, the document stands valid. In the generated xml document xsi:nil attribute for postalCode element is true. But, when I give some integer input to postalCode and submit the form, the document is invalidated and the form submission fails. Kindly help me resolve this issue. Thanks and Regards, Somya **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- 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 |
Following should set xsi:nil="false" when there is data in element:
<xforms:bind nodeset="//@xsi:nil" calculate=".. = ''"/> This one-liner makes all xsi:nil-s in your instance automatically match contents. Thanks for the "//" hint! Tambet On 26.11.2010 9:56, Somya Rajesh Agarwal wrote: > Hi, > > I want to allow integer/date typed elements to be valid even when empty. > > I am setting the element postalCode to type integer in the schema declaration. > <xs:element name="postalCode" type="xs:integer" nillable="true" /> > > In the model instance I have set the xsi:nil attribute to true. > <postalCode xsi:nil="true"/> > Also, am using the namespace "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in my document for this purpose. > > I want that whenever the postalCode element is left empty by the user, xsi:nil="true" is used to pass the xml validation. > However, when the postalCode element gets the user input, xsi:nil is either set to "false" or is made irrelevant. I am using the below code for making xsi:nil irrelevant. > <xforms:bind nodeset="//@xsi:nil" relevant="count(text())=0"/> > > Now, when I submit the form with empty postalCode element, the document stands valid. In the generated xml document xsi:nil attribute for postalCode element is true. > But, when I give some integer input to postalCode and submit the form, the document is invalidated and the form submission fails. > > Kindly help me resolve this issue. > > Thanks and Regards, > Somya > > **************** CAUTION - Disclaimer ***************** > This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely > for the use of the addressee(s). If you are not the intended recipient, please > notify the sender by e-mail and delete the original message. Further, you are not > to copy, disclose, or distribute this e-mail or its contents to any other person and > any such actions are unlawful. This e-mail may contain viruses. Infosys has taken > every reasonable precaution to minimize this risk, but is not liable for any damage > you may sustain as a result of any virus in this e-mail. You should carry out your > own virus checks before opening the e-mail or attachment. Infosys reserves the > right to monitor and review the content of all messages sent to or from this e-mail > address. Messages sent to or from this e-mail address may be stored on the > Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- 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 |
In reply to this post by Somya Rajesh Agarwal
Soumya,
How about you try using xforms types instead of XML types. xforms types allow empty values and the field is not validated. <xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms">
<xforms:bind nodeset="instance('instance')/startDate" type="xforms:date" required="true()"/> </xhtml> /Binesh
On Fri, Nov 26, 2010 at 2:56 AM, Somya Rajesh Agarwal <[hidden email]> wrote: Hi, -- 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 |
In reply to this post by Tambet Matiisen
Hi,
I used the following line to automatically set the value of xsi:nil : <xforms:bind nodeset="//@xsi:nil" calculate="count(text()) le 0"/> It works fine for the empty element but when I give some some integer as input submission fails. Can you please suggest the accurate code that would work. Thanks and Regards, Somya -----Original Message----- From: Tambet Matiisen [mailto:[hidden email]] Sent: Friday, November 26, 2010 4:18 PM To: [hidden email] Subject: [ops-users] Re: XML Schema validation on empty elements of type integer or date Following should set xsi:nil="false" when there is data in element: <xforms:bind nodeset="//@xsi:nil" calculate=".. = ''"/> This one-liner makes all xsi:nil-s in your instance automatically match contents. Thanks for the "//" hint! Tambet On 26.11.2010 9:56, Somya Rajesh Agarwal wrote: > Hi, > > I want to allow integer/date typed elements to be valid even when empty. > > I am setting the element postalCode to type integer in the schema declaration. > <xs:element name="postalCode" type="xs:integer" nillable="true" /> > > In the model instance I have set the xsi:nil attribute to true. > <postalCode xsi:nil="true"/> > Also, am using the namespace "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in my document for this purpose. > > I want that whenever the postalCode element is left empty by the user, xsi:nil="true" is used to pass the xml validation. > However, when the postalCode element gets the user input, xsi:nil is either set to "false" or is made irrelevant. I am using the below code for making xsi:nil irrelevant. > <xforms:bind nodeset="//@xsi:nil" relevant="count(text())=0"/> > > Now, when I submit the form with empty postalCode element, the document stands valid. In the generated xml document xsi:nil attribute for postalCode element is true. > But, when I give some integer input to postalCode and submit the form, the document is invalidated and the form submission fails. > > Kindly help me resolve this issue. > > Thanks and Regards, > Somya > > **************** CAUTION - Disclaimer ***************** This e-mail > contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for > the use of the addressee(s). If you are not the intended recipient, > please notify the sender by e-mail and delete the original message. > Further, you are not to copy, disclose, or distribute this e-mail or > its contents to any other person and any such actions are unlawful. > This e-mail may contain viruses. Infosys has taken every reasonable > precaution to minimize this risk, but is not liable for any damage you > may sustain as a result of any virus in this e-mail. You should carry > out your own virus checks before opening the e-mail or attachment. > Infosys reserves the right to monitor and review the content of all > messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. > ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- 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 |
Hi Somya!
Could you please elaborate your use case? I don't understand what you are trying to achieve with expression "count(text()) le 0". Is seems like a circular expression to me, eg text() references the text value of the very same xsi:nil attribute. And why my example didn't work? Tambet On 29.11.2010 12:01, Somya Rajesh Agarwal wrote: > Hi, > > I used the following line to automatically set the value of xsi:nil : > > <xforms:bind nodeset="//@xsi:nil" calculate="count(text()) le 0"/> > > It works fine for the empty element but when I give some some integer as input submission fails. > Can you please suggest the accurate code that would work. > > Thanks and Regards, > Somya > > -----Original Message----- > From: Tambet Matiisen [mailto:[hidden email]] > Sent: Friday, November 26, 2010 4:18 PM > To: [hidden email] > Subject: [ops-users] Re: XML Schema validation on empty elements of type integer or date > > Following should set xsi:nil="false" when there is data in element: > <xforms:bind nodeset="//@xsi:nil" calculate=".. = ''"/> > > This one-liner makes all xsi:nil-s in your instance automatically match contents. Thanks for the "//" hint! > > Tambet > > On 26.11.2010 9:56, Somya Rajesh Agarwal wrote: >> Hi, >> >> I want to allow integer/date typed elements to be valid even when empty. >> >> I am setting the element postalCode to type integer in the schema declaration. >> <xs:element name="postalCode" type="xs:integer" nillable="true" /> >> >> In the model instance I have set the xsi:nil attribute to true. >> <postalCode xsi:nil="true"/> >> Also, am using the namespace "xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" in my document for this purpose. >> >> I want that whenever the postalCode element is left empty by the user, xsi:nil="true" is used to pass the xml validation. >> However, when the postalCode element gets the user input, xsi:nil is either set to "false" or is made irrelevant. I am using the below code for making xsi:nil irrelevant. >> <xforms:bind nodeset="//@xsi:nil" relevant="count(text())=0"/> >> >> Now, when I submit the form with empty postalCode element, the document stands valid. In the generated xml document xsi:nil attribute for postalCode element is true. >> But, when I give some integer input to postalCode and submit the form, the document is invalidated and the form submission fails. >> >> Kindly help me resolve this issue. >> >> Thanks and Regards, >> Somya >> >> **************** CAUTION - Disclaimer ***************** This e-mail >> contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for >> the use of the addressee(s). If you are not the intended recipient, >> please notify the sender by e-mail and delete the original message. >> Further, you are not to copy, disclose, or distribute this e-mail or >> its contents to any other person and any such actions are unlawful. >> This e-mail may contain viruses. Infosys has taken every reasonable >> precaution to minimize this risk, but is not liable for any damage you >> may sustain as a result of any virus in this e-mail. You should carry >> out your own virus checks before opening the e-mail or attachment. >> Infosys reserves the right to monitor and review the content of all >> messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. >> ***INFOSYS******** End of Disclaimer ********INFOSYS*** -- 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 |
Free forum by Nabble | Edit this page |