Administrator
|
This post was updated on .
(Updated to use aa instead of a, and bb instead b, so Nabble doesn't think I want to have something in bold.)
Hi Vedha, I am just trying to understand your requirement here: your "samples" instance will most likely look like <info><aa/><bb/></info>, but you're saying that if <aa> is empty and <bb> is 2, you want <info>2</info> to be submitted. What about if <aa/> and <bb/> are non-empty? Or that wouldn't be possible for that form? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Administrator
|
(Reposting my answer, using aa instead of a, and bb instead b, so Nabble doesn't think I want to have something in bold.)
Hi Vedha, I am just trying to understand your requirement here: your "samples" instance will most likely look like <info><aa/><bb/></info>, but you're saying that if <aa> is empty and <bb> is 2, you want <info>2</info> to be submitted. What about if <aa/> and <bb/> are non-empty? Or that wouldn't be possible for that form? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
This post was updated on .
Thanks for your response. Below are the cases,
if aa = '2', bb = '', then submit should be, <xf:instance id="samples"> <info xmlns=""> <aa>2</aa> </info> </xf:instance> if aa = '2', bb = '22', then submit should be, <xf:instance id="samples"> <info xmlns=""> <aa>2</aa> <bb>22</bb> </info> </xf:instance> if aa = '', bb = '', then submit should be, <xf:instance id="samples"> <info xmlns=""> </info> </xf:instance> In both the cases, both fields should be available on screen. Note: My question does look conflict with data in my previous post question, this because of the b tag which i used. Now i am using aa and bb tag. |
Administrator
|
Hi Vedha,
Got it. To do this, you could leverage the <xf:submission> ability to prune non-relevant nodes from the XML when it sends the data: - If you have own submission, use the relevant="true" attribute. - If in the context of Form Runner, and you're triggering the submission from an process, use send(prune = "true"). In addition, you'll need to make those empty nodes non-relevant, and this only when the submission happens. You could do this by having an attribute set to true upon submission, with an xf:setvalue, say on <info submitting="true">…</info>, and then in the binds check on that attribute, e.g.: <xf:bind ref="instance('samples')/(aa, bb)" relevant=". != '' or instance('samples')/submitting != 'true'"/> And since you don't want the "submitting" attribute to be included, you could always make it non-relevant: <xf:bind ref="instance('samples')/@submitting" relevant="false()"/> Would something along those lines work for you? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Got this. One more blind question, just curious.
Is there a way in Orbeon to display a particular field on screen when the ref XML node is not available?. And also, when user enter some value on that field, then we need to create that XML node. For example, Initial instance, <instance id='sample'> <SAMPLE> </SAMPLE> </instance> Input field, I want to display this field, even though that ref mapped element (SUPER) is not available in Instance. <xf:input ref="instance('sample')/SAMPLE/SUPER"> And when your input some values on this input field, then That element should be created in instance (Not while submitting), <instance id='sample'> <SAMPLE> <SUPER>User Value</SUPER> </SAMPLE> </instance> I know we can have temp instance and achieve this functionality, my question would be, is there a generic way in Orbeon to handle scenarios like this Optional fields with ref node not present. |
Administrator
|
Hi Vedha,
Unfortunately not. When a ref expression returns an empty sequence, the control is considered to be non-relevant. So if you expect users to fill out a certain field, the corresponding node will need to exist in the XML. Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Free forum by Nabble | Edit this page |