Redirecting to a different page on xforms-ready

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

Redirecting to a different page on xforms-ready

Wouter Zelle
Hi,

I want to prevent users from resubmitting the same form after using the back-button of the browser. I would like to simply clear the form and redirect to the first edit page (edit-1) after the back-button is used from the confirmation page (the page after the submit). To test this, I was trying to do a redirect after the xforms-ready event, by putting this code in the model:

<xforms:action ev:event="xforms-ready">
    <xforms:setvalue ref="instance('main-instance')/action">edit-1</xforms:setvalue>
    <xforms:send submission="go-back"/>
</xforms:action>


The idea is that directly when loading this page, there is a redirect to the first edit-page. Then I can put an if-check on the action and only fire it when the back button is used to return to this page. However, the code above doesn't work (although <xforms:send submission="go-back"/> works when triggered by a button). I'm a bit confused, should this work?

Regards,

Wouter


--
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: Redirecting to a different page on xforms-ready

Wouter Zelle
Nobody responded to my message. Is it clear what I'm trying to do?

Regards,

Wouter Zelle


On Tue, Jun 30, 2009 at 14:45, Wouter Zelle <[hidden email]> wrote:
Hi,

I want to prevent users from resubmitting the same form after using the back-button of the browser. I would like to simply clear the form and redirect to the first edit page (edit-1) after the back-button is used from the confirmation page (the page after the submit). To test this, I was trying to do a redirect after the xforms-ready event, by putting this code in the model:

<xforms:action ev:event="xforms-ready">
    <xforms:setvalue ref="instance('main-instance')/action">edit-1</xforms:setvalue>
    <xforms:send submission="go-back"/>
</xforms:action>


The idea is that directly when loading this page, there is a redirect to the first edit-page. Then I can put an if-check on the action and only fire it when the back button is used to return to this page. However, the code above doesn't work (although <xforms:send submission="go-back"/> works when triggered by a button). I'm a bit confused, should this work?

Regards,

Wouter



--
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: Redirecting to a different page on xforms-ready

Alessandro Vernet
Administrator
Wouter,

Wouter Zelle wrote
To test this, I was trying to do a redirect after the xforms-ready event, by putting this code in the model: [...]
I don't quite understand the scheme you have in mind, but I think a simple way to handle this is to generate an ID, say with: digest(string(random(true)), 'MD5', 'hex'), store it in a node of an instance on xforms-model-construct-done. You submit that ID as part of the instance when submitting the data, and the server keeps that ID around. If the user hit back and submits again, the server will get the same ID and will be able to tell the client that this data has been already saved.

Alex
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re directing to a different page on xforms-ready

Wouter Zelle
Hi Alex,

That is the less desirable alternative, but what I really want to do is to jump back to the first page after emptying the main-instance. In other words, I want to reset the form when the user uses the back button to go back to the previous, pre-submit page (not just when the user clicks the submit button for the second time). However, I can't seem to get the form to redirect to another page while loading another page. Is this possible or can you only change pages when the user clicks a button?

Met vriendelijke groet,

Wouter Zelle


On Tue, Jul 7, 2009 at 07:37, Alessandro Vernet <[hidden email]> wrote:

Wouter,


Wouter Zelle wrote:
>
> To test this, I was trying to do a redirect after the xforms-ready event,
> by putting this code in the model: [...]
>

I don't quite understand the scheme you have in mind, but I think a simple
way to handle this is to generate an ID, say with:
digest(string(random(true)), 'MD5', 'hex'), store it in a node of an
instance on xforms-model-construct-done. You submit that ID as part of the
instance when submitting the data, and the server keeps that ID around. If
the user hit back and submits again, the server will get the same ID and
will be able to tell the client that this data has been already saved.

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context: http://www.nabble.com/Redirecting-to-a-different-page-on-xforms-ready-tp24271360p24367418.html
Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.



--
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
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re directing to a different page on xforms-ready

Alessandro Vernet
Administrator
Wouter,

Wouter Zelle wrote
However, I can't seem to get the form to
redirect to another page while loading another page. Is this possible or can
you only change pages when the user clicks a button?
You can do a redirect in a page as soon as it loads by running an <xforms:load> on xforms-model-construct-done. The example init-load.xhtml in the XForms sandbox shows in this in action.

Alex