Hello!
I have a form for which sections are available based on a value coming from a web service; the relevance condition put on the specific section bind is working alright in view/edit mode; however, when generating the PDF, the condition is never met. It looks like the variables are assessed only at the beginning and after the submission to the web service is done the variables are not re-computed, thus the "relevant" condition is not met. The code is structured in the following way: <xf:model id="fr-form-model" xxf:expose-xpath-types="true"> <xf:var name="is-application-stage-mode" value="(instance('workflow-data')/*:staging/*:stage = 'application')"/> <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all">....</xf:instance> <xf:action ev:event="xforms-model-construct-done"> <xf:send submission="retrieve-workflow-data"/> </xf:action> <xf:submission id="retrieve-workflow-data" method="get" instance="workflow-data" replace="instance" serialization="application/xml" validate="false" resource="{xxf:property('esif.marklogic.base')}/workflow/{xxf:instance('fr-form-instance')/*:uids/*:application}"/> <xf:instance id="workflow-data"> <workflow/> </xf:instance> ... <xf:bind id="questionaire-bind" name="questionaire" ref="questionaire" relevant="$is-application-stage-mode"> ... </xf:model> Please let me know if I missed something, or if this is an issue. Thanks! |
Administrator
|
Hi Silvia,
Are you using the PDF template or the automatic PDF generation? Would you be able to share with us a minimal form that allows us to reproduce this? Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
Hello!
I'm using the automatic PDF generation. I'll have to clean up the form a little bit before sharing it. I'll come up with the form sample as soon as possible. Thanks! |
Administrator
|
Silvia, got it about automatic PDF generation. And about the example, it is sometimes easier to created something from scratch just showing the issue, than to simplify the form you already have. But of course, you can do whatever works the best for you.
Alex
--
Follow Orbeon on Twitter: @orbeon Follow me on Twitter: @avernet |
In reply to this post by silviarausanu
Hello!
This is pretty much the form I have: <xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xmlns:xxi="http://orbeon.org/oxf/xml/xinclude" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:saxon="http://saxon.sf.net/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fb="http://orbeon.org/oxf/xml/form-builder" xmlns:xxf="http://orbeon.org/oxf/xml/xforms" xmlns:sql="http://orbeon.org/oxf/xml/sql" xmlns:fr="http://orbeon.org/oxf/xml/form-runner" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xf="http://www.w3.org/2002/xforms" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:exf="http://www.exforms.org/exf/1-0"> <xh:head> <xh:title>Application</xh:title> <xf:model id="fr-form-model" xxf:expose-xpath-types="true"> <xf:var name="is-application-stage-mode" value="instance('workflow-data')/*:staging/*:stage = 'application'"/> <xf:instance id="fr-form-instance" xxf:exclude-result-prefixes="#all"> <form> <generic-section> <some-data/> </generic-section> <conditional-section> <more-data/> <questions> <questions-iteration> <question>Question 1</question> <answer>-1</answer> <score/> </questions-iteration> <questions-iteration> <question>Question 2</question> <answer>-1</answer> <score/> </questions-iteration> </questions> </conditional-section> </form> </xf:instance> <xf:action ev:event="xforms-model-construct-done"> <xf:send submission="retrieve-workflow-data"/> </xf:action> <xf:submission id="retrieve-workflow-data" method="get" instance="workflow-data" replace="instance" serialization="application/xml" validate="false" resource=" http://demo0202971.mockable.io/workflow/data/full-application/1"/> <xf:instance id="workflow-data"> <workflow/> </xf:instance> <xf:bind id="fr-form-binds" ref="instance('fr-form-instance')"> <xf:bind id="generic-section-bind" name="generic-section" ref="generic-section"> <xf:bind id="some-data-bind" name="some-data" ref="some-data"/> </xf:bind> <xf:bind id="conditional-section-bind" ref="conditional-section" name="conditional-section" relevant="$is-application-stage-mode"> <xf:bind id="go-questions-bind" ref="questions" name="questions"> <xf:bind id="go-questions-iteration-bind" ref="questions-iteration" name="questions-iteration"> <xf:bind id="go-question-bind" ref="question" name="question"/> <xf:bind id="go-answer-bind" ref="answer" name="answer"/> <xf:bind id="go-score-bind" ref="score" name="score"/> </xf:bind> </xf:bind> <xf:bind id="more-data-bind" ref="more-data" name="more-data"/> </xf:bind> </xf:bind> <xf:instance xxf:readonly="true" id="fr-form-metadata" xxf:exclude-result-prefixes="#all"> <metadata> <application-name>orbeon</application-name> <form-name>application</form-name> <title xml:lang="en">Application</title> <description xml:lang="en"/> <singleton>false</singleton> </metadata> </xf:instance> <xf:instance id="fr-form-attachments" xxf:exclude-result-prefixes="#all"> <attachments> <css mediatype="text/css" filename="" size=""/> <pdf mediatype="application/pdf" filename="" size=""/> </attachments> </xf:instance> <xf:instance id="fr-form-resources" xxf:readonly="false" xxf:exclude-result-prefixes="#all"> <resources> <resource xml:lang="en"> <more-data> <label>Conditional data</label> <hint/> </more-data> <generic-section> <label>Generic Data section</label> </generic-section> <conditional-section> <label>Conditional area</label> <help/> </conditional-section> <some-data> <label>Generic data </label> <hint/> </some-data> <question> <label>Question</label> <help/> </question> <answer> <label>Answer</label> <hint/> <item> <label>N/A</label> <hint/> <value>-1</value> </item> <item> <label>Unsatisfactory</label> <hint/> <value>0</value> </item> <item> <label>Satisfactory</label> <hint/> <value>1</value> </item> <item> <label>Good</label> <hint/> <value>2</value> </item> </answer> <score> <label>Score</label> <hint/> <item> <label>0</label> <hint/> <value>0</value> </item> <item> <label>1</label> <hint/> <value>1</value> </item> <item> <label>2</label> <hint/> <value>2</value> </item> <item> <label>3</label> <hint/> <value>3</value> </item> </score> </resource> </resources> </xf:instance> <xf:instance id="fr-service-request-instance" xxf:exclude-result-prefixes="#all"> <request/> </xf:instance> <xf:instance id="fr-service-response-instance" xxf:exclude-result-prefixes="#all"> <response/> </xf:instance> <xf:instance xxf:exclude-result-prefixes="#all" id="questions-template"> <questions-iteration> <question/> <answer>-1</answer> <score/> </questions-iteration> </xf:instance> </xf:model> </xh:head> <xh:body> <fr:view> <fr:body xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"> <fr:section id="generic-section-control" bind="generic-section-bind"> <xf:label ref="$form-resources/generic-section/label"/> <fr:grid> <xh:tr> <xh:td> <xf:input id="some-data-control" bind="some-data-bind"> <xf:label ref="$form-resources/some-data/label"/> <xf:hint ref="$form-resources/some-data/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> </xf:input> </xh:td> <xh:td/> </xh:tr> </fr:grid> </fr:section> <fr:section id="conditional-section-control" bind="conditional-section-bind"> <xf:label ref="$form-resources/conditional-section/label"/> <fr:grid> <xh:tr> <xh:td> <xf:input id="more-data-control" bind="more-data-bind"> <xf:label ref="$form-resources/more-data/label"/> <xf:hint ref="$form-resources/more-data/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> </xf:input> </xh:td> </xh:tr> </fr:grid> <fr:grid id="general-overview-questions-control" bind="go-questions-bind" repeat="content" min="2" max="2" template="instance('questions-template')"> <xh:tr> <xh:td> <xf:output id="go-question-control" bind="go-question-bind"> <xf:label ref="$form-resources/question/label"/> <xf:hint ref="$form-resources/question/hint"/> <xf:alert ref="$form-resources/question/alert"/> </xf:output> </xh:td> <xh:td> <xf:select1 id="got-answer-control" appearance="full" bind="go-answer-bind"> <xf:label ref="$form-resources/answer/label"/> <xf:hint ref="$form-resources/answer/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> <xf:itemset ref="$form-resources/answer/item"> <xf:label ref="label"/> <xf:value ref="value"/> <xf:hint ref="hint"/> </xf:itemset> </xf:select1> </xh:td> <xh:td> <fr:dropdown-select1 xmlns:xxbl="http://orbeon.org/oxf/xml/xbl" id="got-score-control" bind="go-score-bind"> <xf:label ref="$form-resources/score/label"/> <xf:hint ref="$form-resources/score/hint"/> <xf:alert ref="$fr-resources/detail/labels/alert"/> <xf:itemset ref="$form-resources/score/item"> <xf:label ref="label"/> <xf:value ref="value"/> <xf:hint ref="hint"/> </xf:itemset> </fr:dropdown-select1> </xh:td> </xh:tr> </fr:grid> </fr:section> </fr:body> <fr:buttons xmlns:oxf="http://www.orbeon.com/oxf/processors" xmlns:p="http://www.orbeon.com/oxf/pipeline" xmlns:xbl="http://www.w3.org/ns/xbl"> <fr:submit-button/> <fr:pdf-button/> </fr:buttons> </fr:view> </xh:body> </xh:html> Thanks! |
Administrator
|
Silvia,
The issue might be that your form doesn't follow the Form Runner conventions. For example, if a control has id: got-score-control The associated bind MUST be: got-score-bind Similarly, your repeated grid has id: general-overview-questions-control which means the bind MUST be: general-overview-questions-bind and the template MUST have id: general-overview-questions-template Etc. Form Runner and Form Builder make these assumptions at design time and at runtime, and if they don't hold things can break. So I would recommend making ids, binds, names, etc. all in sync this way. -Erik |
Free forum by Nabble | Edit this page |