[Seaside] Re: jQuery Ajax: do something before and after

jtuchel at objektfabrik.de jtuchel at objektfabrik.de
Tue Mar 19 14:03:12 UTC 2013


Hi Ryan,

you are right. Adding  return: false to the ajax object is exactly the 
right thing to do. I feel so stupid.

So this brings me to my next problem: How would I do one of the 
following (which I did in the submitButton's callback block):
* navigate to another component (usign show:, for example)
* Re-render teh component itself (which is what I did before: I just had 
an empty callback and the component would re-render itself based on 
state that was changed in the ajax callback)

Joachim

Am 19.03.13 14:50, schrieb Ryan Simmons:
> Adding return: false should work. It you want to stop the default 
> submit action and have the button act as ajax only.
>
> renderContentOn: html
>  html form: [
> html textInput
>   id: 'text';
>   class: 'submit';
>   with: 'Test für Ajax-Actions'.
>   html submitButton
>      callback: [];
>       onClick: (((html jQuery ajax)
>           onBeforeSend: ((html jQuery class: 'submit') hide);
>           callback: [self doSomeStuff];
>           onComplete: ((html jQuery class: 'submit') show);
>             return: false));
>         with: 'Test mit onBeforeSend'].
>
>
> On 19 March 2013 15:41, jtuchel at objektfabrik.de 
> <mailto:jtuchel at objektfabrik.de> <jtuchel at objektfabrik.de 
> <mailto:jtuchel at objektfabrik.de>> wrote:
>
>     So maybe I should spend a few more words on what I mean by "working".
>
>     My intention is to hide certain cotrols on screen while a longer
>     running ajax call is being executed. After the callback was
>     completed, the controls should come back.
>     When I say it's not working, I mean that the ajax callback is
>     executed, even in Chrome, but the hiding of controls doesn't happen.
>
>     Once I've got this running reliably on at least four different
>     browsers, I really want to use some "please wait" lightbox dialog,
>     but I wanted to start simple - and failed...
>
>     Joachim
>
>     Am 19.03.13 14:23, schrieb jtuchel at objektfabrik.de
>     <mailto:jtuchel at objektfabrik.de>:
>
>         Hmmm,
>
>         I sent this message using Nabble, and it seems it swallowed my
>         code samples that I had put between <raw> tags. I guess I have
>         general troubles when I wrap tags into between others ;-)))
>
>         Anyways: here are the two code samples, first the one that works:
>
>         renderContentOn: html
>             html textInput
>                 id: 'text';
>                 class: 'submit';
>                 with: 'Test für Ajax-Actions'.
>                 html submitButton
>                     callback: [];
>                     onClick: (((html jQuery ajax)
>                         onBeforeSend: ((html jQuery class: 'submit')
>         hide);
>                         callback: [self doSomeStuff];
>                         onComplete: ((html jQuery class: 'submit')
>         show)));
>                     with: 'Test mit onBeforeSend'.
>
>
>         and here is the one that doesn't:
>
>         renderContentOn: html
>            html form: [
>             html textInput
>                 id: 'text';
>                 class: 'submit';
>                 with: 'Test für Ajax-Actions'.
>                 html submitButton
>                    callback: [];
>                     onClick: (((html jQuery ajax)
>                         onBeforeSend: ((html jQuery class: 'submit')
>         hide);
>                         callback: [self doSomeStuff];
>                         onComplete: ((html jQuery class: 'submit')
>         show)));
>                     with: 'Test mit onBeforeSend'].
>
>         The last one doesn't work in chrome and Safari. In Firefox it
>         seems to call the ajax callback very unreliably.
>
>         Any ideas?
>
>         Joachim
>
>
>         Am 19.03.13 14:18, schrieb jtuchel:
>
>             Hi there,
>
>             I am back with this issue. I finally found the difference
>             that renders these
>             two options unusable. Once you wrap the submitButton into
>             a form tag, the
>             ajax thingie is screwed, at least in Chrome.
>
>             So there is a significant difference between this:
>
>
>
>
>             and this:
>
>
>
>
>             While the first example works as expected, the button in a
>             form doesn't in
>             chrome.
>             Is this a known limitation that I should have been aware
>             of? Is there any
>             reason for this difference in behavior? How do other
>             seasiders handle this?
>             Are forms bad per se in conjunction with Ajax??? This
>             woulkd be totally new
>             to me...
>
>             Joachim
>
>
>
>
>
>
>             -- 
>             View this message in context:
>             http://forum.world.st/jQuery-Ajax-do-something-before-and-after-tp4664568p4677296.html
>             Sent from the Seaside General mailing list archive at
>             Nabble.com.
>             _______________________________________________
>             seaside mailing list
>             seaside at lists.squeakfoundation.org
>             <mailto:seaside at lists.squeakfoundation.org>
>             http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>         _______________________________________________
>         seaside mailing list
>         seaside at lists.squeakfoundation.org
>         <mailto:seaside at lists.squeakfoundation.org>
>         http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>     _______________________________________________
>     seaside mailing list
>     seaside at lists.squeakfoundation.org
>     <mailto:seaside at lists.squeakfoundation.org>
>     http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



More information about the seaside mailing list