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

Ryan Simmons ryan.craig.simmons at gmail.com
Tue Mar 19 13:50:57 UTC 2013


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 <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:
>
>  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<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<seaside at lists.squeakfoundation.org>
>>> http://lists.squeakfoundation.**org/cgi-bin/mailman/listinfo/**seaside<http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>>>
>>>
>> ______________________________**_________________
>> seaside mailing list
>> seaside at lists.**squeakfoundation.org <seaside at lists.squeakfoundation.org>
>> http://lists.squeakfoundation.**org/cgi-bin/mailman/listinfo/**seaside<http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>>
>>
> ______________________________**_________________
> seaside mailing list
> seaside at lists.**squeakfoundation.org <seaside at lists.squeakfoundation.org>
> http://lists.squeakfoundation.**org/cgi-bin/mailman/listinfo/**seaside<http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20130319/64d64187/attachment-0001.htm


More information about the seaside mailing list