Best way to navigate to successor page in Orbeon XForms

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Best way to navigate to successor page in Orbeon XForms

Gunzenreiner Simon
Best way to navigate to successor page in Orbeon XForms

Hi all

Problem:

-       RESTful WS call (PUT), which returns a 200 status, but no content in the resulting page (since it is only a WS call …)

-       On success, a new page should be loaded. Which page should be controlled by the application, and not the result of the WS call.

Attempt 1:

-       Using a submission element on the xhtml page + local submissions:

        <xf:submission id="save-submission" ref="instance(mydata')" method="put" replace="all" f:url-norewrite="true" resource="/config-server/easy/tickets/order/dev-support-1">

                <xf:message ev:event="xforms-submit-error" level="modal">An error occurred while sending!</xf:message>

                <xf:load ev:event="xforms-submit-done" resource="/mynext-page" show="replace" />

        </xf:submission>

The problem here is that the xf:load does not seem to get executed, even though the form is successfully submitted. Instead, the (blank) response of the WS request is shown (note that we are dealing with local submissions here). Does anyone have an idea why?

Attempt 2:

-       Send the form to the URL it was loaded from, and on the matching <page> element in page-flow.xml ..

-       define an action which is only triggered if the form model is valid.
<action when="/question != ''" action="send-submission.xpl">
   
<result page="index" instance-passing="redirect" />
</action>

-       The send-submission.xpl looks like this:
<p:param name="instance" type="input"/>
<p:param name="data" type="output"/>

      <p:processor name="oxf:xforms-submission">

         <p:input name="submission">
          
      <xforms:submission method="put" resource="/myrestful-service" f:url-norewrite="true" />

         </p:input>

               <p:input name="request" href="#instance" />

               <p:output name="response" ref="data" />
           
</p:processor>

So at least what I achieved is a redirect after a form submit, but it's like cracking a nut with a sledgehammer Also, if during the submission an error happens, the redirect takes place without warning.

Best regards,

Simon



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

AW: Best way to navigate to successor page in Orbeon XForms

Gunzenreiner Simon
Best way to navigate to successor page in Orbeon XForms

Hi all

 

Just wanted to share how I go "attempt 1" from below to work. If I am not using replace="all" but rather replace="instance" or "none", the load action is triggered as expected (… well, once a NullPointerException is prevented, see http://forge.ow2.org/tracker/index.php?func=detail&aid=315257&group_id=168&atid=350207). So it seems, that only replace="all" does not trigger the xforms-submit-done.

 

Best regards,

Simon

 

Von: Gunzenreiner Simon [mailto:[hidden email]]
Gesendet: Montag, 16.
August 2010 16:44
An: [hidden email]
Betreff: [ops-users] Best way to navigate to successor page in Orbeon XForms

 

Hi all

Problem:

-       RESTful WS call (PUT), which returns a 200 status, but no content in the resulting page (since it is only a WS call …)

-       On success, a new page should be loaded. Which page should be controlled by the application, and not the result of the WS call.

Attempt 1:

-       Using a submission element on the xhtml page + local submissions:

        <xf:submission id="save-submission" ref="instance(mydata')" method="put" replace="all" f:url-norewrite="true" resource="/config-server/easy/tickets/order/dev-support-1">

                <xf:message ev:event="xforms-submit-error" level="modal">An error occurred while sending!</xf:message>

                <xf:load ev:event="xforms-submit-done" resource="/mynext-page" show="replace" />

        </xf:submission>

The problem here is that the xf:load does not seem to get executed, even though the form is successfully submitted. Instead, the (blank) response of the WS request is shown (note that we are dealing with local submissions here). Does anyone have an idea why?

Attempt 2:

-       Send the form to the URL it was loaded from, and on the matching <page> element in page-flow.xml ..

-       … define an action which is only triggered if the form model is valid.
<action when="/question != ''" action="send-submission.xpl">
    <result page="index" instance-passing="redirect" />
</action>

-       The send-submission.xpl looks like this:
<p:param name="instance" type="input"/>

<p:param name="data" type="output"/>

<p:processor name="oxf:xforms-submission">

   <p:input name="submission">
     <xforms:submission method="put" resource="/myrestful-service" f:url-norewrite="true" />

   </p:input>

               <p:input name="request" href="#instance" />

               <p:output name="response" ref="data" />
            </p:processor>

So at least what I achieved is a redirect after a form submit, but it's like cracking a nut with a sledgehammer … Also, if during the submission an error happens, the redirect takes place without warning.

Best regards,

Simon



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: AW: Best way to navigate to successor page in Orbeon XForms

Erik Bruchez
Administrator
Simon,

Thanks for the bug report, I have fixed the NPE locally.

XForms 1.1 does not mandate that xforms-submit-done actually be
dispatched after a replace="all". The idea is that in some
environments, e.g. browsers, you just can't know whether a submission
is successful or not. It's a sort of "fire and forget" type of
behavior.

-Erik

On Mon, Aug 16, 2010 at 11:48 AM, Gunzenreiner Simon
<[hidden email]> wrote:

> Hi all
>
>
>
> Just wanted to share how I go "attempt 1" from below to work. If I am not
> using replace="all" but rather replace="instance" or "none", the load action
> is triggered as expected (… well, once a NullPointerException is prevented,
> see
> http://forge.ow2.org/tracker/index.php?func=detail&aid=315257&group_id=168&atid=350207).
> So it seems, that only replace="all" does not trigger the
> xforms-submit-done.
>
>
>
> Best regards,
>
> Simon
>
>
>
> Von: Gunzenreiner Simon [mailto:[hidden email]]
> Gesendet: Montag, 16. August 2010 16:44
> An: [hidden email]
> Betreff: [ops-users] Best way to navigate to successor page in Orbeon XForms
>
>
>
> Hi all
>
> Problem:
>
> -       RESTful WS call (PUT), which returns a 200 status, but no content in
> the resulting page (since it is only a WS call …)
>
> -       On success, a new page should be loaded. Which page should be
> controlled by the application, and not the result of the WS call.
>
> Attempt 1:
>
> -       Using a submission element on the xhtml page + local submissions:
>
>         <xf:submission id="save-submission" ref="instance(mydata')"
> method="put" replace="all" f:url-norewrite="true"
> resource="/config-server/easy/tickets/order/dev-support-1">
>
>                 <xf:message ev:event="xforms-submit-error" level="modal">An
> error occurred while sending!</xf:message>
>
>                 <xf:load ev:event="xforms-submit-done"
> resource="/mynext-page" show="replace" />
>
>         </xf:submission>
>
> The problem here is that the xf:load does not seem to get executed, even
> though the form is successfully submitted. Instead, the (blank) response of
> the WS request is shown (note that we are dealing with local submissions
> here). Does anyone have an idea why?
>
> Attempt 2:
>
> -       Send the form to the URL it was loaded from, and on the matching
> <page> element in page-flow.xml ..
>
> -       … define an action which is only triggered if the form model is
> valid.
> <action when="/question != ''" action="send-submission.xpl">
>     <result page="index" instance-passing="redirect" />
> </action>
>
> -       The send-submission.xpl looks like this:
> <p:param name="instance" type="input"/>
> <p:param name="data" type="output"/>
>
> <p:processor name="oxf:xforms-submission">
>
>    <p:input name="submission">
>      <xforms:submission method="put" resource="/myrestful-service"
> f:url-norewrite="true" />
>
>    </p:input>
>
>                <p:input name="request" href="#instance" />
>
>                <p:output name="response" ref="data" />
>             </p:processor>
>
> So at least what I achieved is a redirect after a form submit, but it's like
> cracking a nut with a sledgehammer … Also, if during the submission an error
> happens, the redirect takes place without warning.
>
> Best regards,
>
> Simon
>
> --
> You receive this message as a subscriber of the [hidden email] mailing
> list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>


--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws