Hi,
<xforms:bind nodeset="./title" relevant="false()" required="true()" /> For clarity purposes I removed xpath expression from relevant attribute. Above binding is throwing validation error when I submit with relevant="false" in submission handler(<xforms:submission relevant="false" ...../>). It should ignore required attribute when element is not relevant. I think following code is what is making it invalid. I think we should check if it is relevant before checking required attribute. XFormsModelBinds.java : Line 860 // Current required value (computed during preceding recalculate) final boolean isRequired = InstanceData.getRequired(currentNodeInfo); // This is returning existingInstanceDate.required which is always true in my case. public static boolean getRequired(NodeInfo nodeInfo) { final InstanceData existingInstanceData = getLocalInstanceData(nodeInfo, false); return (existingInstanceData == null) ? DEFAULT_REQUIRED : existingInstanceData.required; } Please advice. Thanks Binesh Gummadi |
Administrator
|
Hi Binesh,
It does work as you expected it; you just need to use relevant="true" on your <xforms:submission> for non-relevant nodes to be pruned. The value of this attribute tells you "whether or not the relevance pruning of the submission is performed" (quoting the spec). Also see attached a test case for this. Alex On Tue, Sep 7, 2010 at 2:24 PM, Binesh Gummadi <[hidden email]> wrote: > > Hi, > > <xforms:bind nodeset="./title" relevant="false()" required="true()" /> > > For clarity purposes I removed xpath expression from relevant attribute. > Above binding is throwing validation error if I submit with relevant="false" > in submission handler(<xforms:submission relevant="false" ...../>). It > should ignore required attribute when element is not relevant. > > I think following code is what is making it invalid. I think we should check > if it is relevant before checking required attribute. > > XFormsModelBinds.java : Line 860 > > // Current required value (computed during preceding recalculate) > final boolean isRequired = InstanceData.getRequired(currentNodeInfo); > > // This is returning existingInstanceDate.required which is always true in > my case. > public static boolean getRequired(NodeInfo nodeInfo) { > final InstanceData existingInstanceData = getLocalInstanceData(nodeInfo, > false); > return (existingInstanceData == null) ? DEFAULT_REQUIRED : > existingInstanceData.required; > } > > Please advice. > > Thanks > Binesh Gummadi > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Unexpected-validation-errors-with-relevant-false-tp2530457p2530457.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > 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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ 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 20100909-relevant-invalid-submission.xhtml (1K) Download Attachment
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
This post was updated on .
Alex,
The idea is to not prune non-relevant nodes. Following is the use case I am trying to solve. I have a dropdown control which has two values; control1 and control2. I have two more controls on the page inputbox and textarea. When control1 is selected from the dropdown, I should display inputbox and if control2 is selected from dropdown I should display textarea. <xforms:instance id="social-media-pod-checkbox-instance"> <items> <dropdown></dropdown> // possible values are control1 and control2 <inputbox></inputbox> // required <textarea></textarea> // required </items> </xforms:instance> Lets consider a case where user selects control1 an inputbox is displayed. During edit user might choose to select control2 but if textarea node is pruned in the initial submit, there is no way for user to see the textarea. I changed the relevant flag to true in order to avoid pruning non-relevant nodes. But now I cannot submit as one of the non-relevant nodes fails validation. Does it make sense? What do you think is the best approach to tackle this scenario? Thanks Binesh Gummadi |
Administrator
|
Binesh,
In that case, I would use a conditional constraint. I.e.: <xforms:bind nodeset="inputbox" required="../dropdown = 'control1'"/> <xforms:bind nodeset="textarea" required="../dropdown = 'control2'"/> Does that make sense? Alex On Thu, Sep 9, 2010 at 7:47 PM, Binesh Gummadi <[hidden email]> wrote: > > Alex, > > The idea is to not to prune non-relevant nodes. Following is the use case I > am trying to solve. > > I have a dropdown control which has two values; control1 and control2. > I have two more controls on the page inputbox and textarea. When control1 is > selected from the dropdown, I should display inputbox and if control2 is > selected from dropdown I should display textarea. > > <xforms:instance id="social-media-pod-checkbox-instance"> > <items> > <dropdown></dropdown> // possible values are control1 and control2 > <inputbox></inputbox> // required > <textarea></textarea> // required > </items> > </xforms:instance> > > Lets consider a case where user selects control1 an inputbox is displayed. > During edit user might choose to select control2 but if textarea node is > pruned in the initial submit, there is no way for user to see the textarea. > > I changed the relevant flag to true in order to avoid pruning non-relevant > nodes. But now I cannot submit as one of the non-relevant nodes fails > validation. > > Does it make sense? What do you think is the best approach to tackle this > scenario? > > Thanks > Binesh Gummadi > > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Unexpected-validation-errors-with-relevant-false-tp2530457p2533826.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > 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 > > -- Orbeon Forms - Web forms, open-source, for the Enterprise - http://www.orbeon.com/ 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 |