Ok, so these are my notes regarding our method for getting Orbeon to load an instance based on some parameters that were sent to the XForm. This posting follows on from where my previous post left off:
In the model declaration of view.xhtml, I've created two minimal instances:
<xf:instance id="first-instance">
<first-instance />
</xf:instance>
<xf:instance id="second-instance">
<second-instance />
</xf:instance>
I'm also adding this piece in - as discussed in the last post - this resolves the get parameters and stores the information in the instance, so you can access the parameters using XPath:
<xf:instance id="edit-params" src="input:instance"/>
We're initialising two ev:events; these fire at different times but both should have fired by the time the XForm has been rendered onscreen:
<xf:send ev:event="xforms-model-construct-done" submission="load-first"/>
<xf:send ev:event="xforms-ready" submission="load-second"/>
As the form loads, xforms-model-construct-done should fire first; xforms-ready should fire soon after that.
So here's the code for the first submission:
<xf:submission id="load-first" method="get" resource="http://path/to/your/load-first-xquery.xq?
id={instance('edit-params')//id}" replace="instance" instance="first-instance"/>
And here's similar code for the second submission - for the sake of example here, I'm using 2 parameters when calling this one...
<xf:submission id="load-second" method="get" resource="http://path/to/your/load-second-xquery.xq?
id={instance('edit-params')//id}&id2={instance('edit-params')//id2}" replace="instance" instance="second-instance"/>
Hope this helps someone.
0 comments:
Post a Comment