Hi,
I'm hoping someone can help -
I've looked around and haven't been able to find a working solution for this, so I thought I'd post to the forum to see if anyone can assist. I'm hoping to be able to pass parameters to the xform when I call the page, so I'd like to be able to do something like this:
http://localhost:8080/orbeon/xforms-get-example/?id=1234&id2=5678I've found 2 promising looking solutions - although I've not had success getting either of them to work properly and I'm hoping someone can offer some suggestions re: either approach.
1st solution (using Orbeon 3.6) and the Page Flow Controller:
I had a look at the example on the page here:
http://www.orbeon.com/ops/doc/reference-page-flow#url-extractionAnd I've edited my page-flow.xml to try and 'pull' those parameters out like this:
<page path-info="*" view="view.xhtml" default-submission="/resources/test.xml">
<setvalue ref="/submission/first" parameter="id"/>
<setvalue ref="/submission/second" parameter="id2"/>
</page>And I've created an 'empty' test.xml file like this:
<?xml version="1.0" encoding="UTF-8"?>
<submission>
<first/>
<second/>
</submission>When I call the page, I get no errors - but I'm not sure how I can access those parameters. The form loads but I'm guessing I need to do something else to make those parameters available? The only thing I could think of trying was to add test.xml as an instance in the model - but of course all that did was literally just add the contents of the empty file. Can anyone point me in the right direction regarding what I can try next with this? Thanks so much.
2nd solution (using the Orbeon 3.7 nightly build):
After a bit more digging, I discovered that Orbeon 3.7 had a new feature called
xxforms:get-request-parameterI grabbed the current nightly build, deployed it, created an instance called 'params' in my page, I saw in the documentation (
http://www.orbeon.com/ops/doc/reference-xforms-2) that you could run xxforms:get-request-parameter from the event 'xforms-model-construct-done', so I created this block of code in my model:
<xf:action ev:event="xforms-model-construct-done">
<xxforms:script ev:event="DOMActivate">weAreDone();</xxforms:script>
<!-- This script runs, so I know the event fires successfully -->
<xf:setvalue ref="instance('params')/one" select="xxforms:get-request-parameter('id')" />
</xf:action>
Now I tried hardcoding value of the ref with setvalue and that seemed to work just fine, but when I use the select="xxforms:get-request-parameter('id')" all I seem to end up with is an empty closed tag (<one />) in my instance.
Can anyone please offer any advice regarding either of these solutions?
Thanks so much,
A