How to load and pass a Xforms form in Orbeon (How to Send instance to XForms) ?

Posted by Clem on Stack Overflow See other posts from Stack Overflow or by Clem
Published on 2010-05-31T14:43:13Z Indexed on 2010/06/01 22:53 UTC
Read the original article Hit count: 397

Filed under:
|
|
|
|

Hi,

I am using the Orbeon Forms solution to generate messages from filled-in web forms.

I read different code snippetse in Orbeon's wiki on XForms submission from a pipeline, and I tried different solutions but it doesn't work, and there is no example with a POST from a pipeline, caught by a PFC and sent to an XForms view that receives the posted data (all examples are done in the same page).

I have the following pipeline which is received on his instance input:

pipelineWrite.xpl

<p:config ...>
    <p:param name="instance" type="input"/> <!-- instance containing the data of the form filled by user -->
    <p:param name="data" type="output"/>

    <p:processor name="oxf:java"> <!-- transforms the data into a file -->
        <p:input name="config">
            <config sourcepath="." class="ProcessorWriteCUSDECCD001B"/>
        </p:input>
        <p:input name="input" href="#instance"/>
        <p:output name="output" id="file"/> <!-- XML containing the url of the file -->
    </p:processor>

        <p:processor name="oxf:xforms-submission"> <!-- post the XML to the success view -->
                <p:input name="submission">
                        <xforms:submission method="post" action="/CUSDECCD001B/success" />
                </p:input>
                <p:input name="request" href="#file"/>
                <p:output name="response" ref="data"/>
        </p:processor>       
</p:config> 

Then there is the PFC which catch the actions :

page-flow.xml

<config xmlns="http://www.orbeon.com/oxf/controller">

    <page path-info="/CUSDECCD001B/" view="View/ViewForm.xhtml"/> <!-- load the form to be filled in by user -->

    <page path-info="/CUSDECCD001B/write" model="Controller/PipelineWrite.xpl"/> <!-- send the instance of the form filled to the pipeline above -->

    <page path-info="/CUSDECCD001B/success" view="View/ViewSuccess.xhtml"/> <!-- send the instance containing the url of the file to the success view -->

    <epilogue url="oxf:/config/epilogue.xpl"/>
</config> 

Then there is the success view, which is very simple :

ViewSuccess.xhtml

<html ... >
  <head>
    <title>Generation OK</title>
    <xforms:model>
            <xforms:instance id="FILE" src="input:instance">
                <files xmlns="">
                    <file mediaType="" filename="" size="" />
                </files>
            </xforms:instance>
        </xforms:model>
  </head>
  <body>
        Click here to download :
        <xforms:output ref="//file" appearance="xxforms:download">
            <xforms:filename ref="@filename"/>
            <xforms:mediatype ref="@mediatype"/>
            <xforms:label>Download</xforms:label>
        </xforms:output>
  </body>
</html> 

The problem is that the post is done well, the PFC catches the action well, load the correct view, but the view is loaded with no data (the view doesn't find the data on his instance input).

I tried with a GET in the view to retrieve the POST data, and that's the same thing. No data is retrieved. So the download button doesn't work.

I hope I'm clear enough to find a solution. Thanks in advance.

© Stack Overflow or respective owner

Related posts about Xml

Related posts about post