[daisy] General Ajax form question
Victor Oomens
victor at oomens-ict.nl
Thu Mar 6 09:50:45 CST 2008
Hi guys,
Here's an update on my progress with ajax forms, for anyone who's interested.
It's actually very simple.
What you have to do with apples is this:
After the form post (with ajax), do normal form processing in the apple.
Now here's the trick: when the form validates, and you want to 'continue' to another page, send a custom browser update xml document as response to the ajax post. The document must contain:
<bu:document>
<bu:continue/>
</bu:document>
This triggers a second post, but this time as non-ajax. You can detect this non-ajax post in the apple and ... well, figure it out.
Cheers!
Victor.
-----Oorspronkelijk bericht-----
Van: daisy-bounces at lists.cocoondev.org [mailto:daisy-bounces at lists.cocoondev.org] Namens Victor Oomens
Verzonden: dinsdag 4 maart 2008 14:43
Aan: 'Daisy: open source CMS - general mailinglist'
Onderwerp: RE: [daisy] General Ajax form question
Hi guys,
Thanks for the help.
I've found a way to do a redirect after an ajax submit. It's not very elegant, but it works for now. I didn't want to use flowscript or javaflow and wanted to stick with the apples.
I've uses a hidden field widget in the form called 'saved', initially set to false.
After the apple processes and saves the form, I set the value of this widget to true and send the ajax response.
In the form template, I've used dojo.event.connect to attach an event handler to BUHandler.processResponse.
Within this handler, I read the value of 'saved'. When this value is true, I use document.location.href to redirect the browser.
Hopefully I may find a better solution in the future.
Kind regards,
Victor
-----Oorspronkelijk bericht-----
Van: daisy-bounces at lists.cocoondev.org [mailto:daisy-bounces at lists.cocoondev.org] Namens Karel Vervaeke
Verzonden: dinsdag 4 maart 2008 12:06
Aan: Daisy: open source CMS - general mailinglist
Onderwerp: Re: [daisy] General Ajax form question
This seems more like a general Ajax (or CForms?) question than a Daisy
question, but here's my shot in the dark:
Try handling the redirect in the browser. To do this, include an
element in your xml response like this:
<redirectTo>/path/to/thankyou.html</redirectTo>
On the client side, handle the response and set document.location to
whatever is found in the redirectTo-element.
HTH,
Karel
On Tue, 2008-03-04 at 11:56 +0100, Victor Oomens wrote:
> Dear all,
>
>
>
> I’m working on translating many forms in Daisy to ajax type. So far
> I’m successfully, that I got the forms working.
>
>
>
> But now my question:
>
>
>
> How can I return to another page after the user completes the form and
> presses the submit button? In my case, the form will be saved by the
> Apple, but the form still gets displayed. A simple redirect after a
> successful form processing won’t work, because the ajax form requires
> a valid xml response after submit.
>
>
>
> Hope someone can help me on this.
>
>
>
> Kind regards,
>
>
>
> Victor.
>
>
> _______________________________________________
> daisy community mailing list
> Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
> mail to: daisy at lists.cocoondev.org
> list information: http://lists.cocoondev.org/mailman/listinfo/daisy
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy at lists.cocoondev.org
list information: http://lists.cocoondev.org/mailman/listinfo/daisy
_______________________________________________
daisy community mailing list
Professional Daisy support: http://outerthought.org/en/services/daisy/support.html
mail to: daisy at lists.cocoondev.org
list information: http://lists.cocoondev.org/mailman/listinfo/daisy
More information about the daisy
mailing list