[Seaside] Re: onClick: plus callback:

bobn at rogers.com bobn at rogers.com
Tue Nov 11 14:46:05 UTC 2014


Joachim,

In answer to your questions: 

* Are you sure the callback isn't executed? Did you check with Browser 
tools if a request is sent to the server?

Yes. We can very clearly see that the onClick: event is triggered on the browser but that no callback: is done.

* Does a server side breakpoint in the callback method fire?

A Transcript message in WACallbackRegistry>>handle: shows that it is not being sent. 


* Is it some obscure ancient Browser version (think IE 8 and below) in 
which this happens?

I test with Chrome (latest version), but I've seen the behaviour in Firefox as well (also latest version).

* Is your onClick: handler more complex than your shown snippet? Does it 
return false or call preventDefault() ? This would be the only 
explanation I can see for the callback not executing.

No. The code is exactly what we used.

* If these hints don't help, try debugging the resulting Javascript on 
your Browser. All current browsers have quite nice tools for debugging 
javascript. The only difficulty here is that it's sometimes hard to find 
and debug js code that was generated by Seaside, because the code is 
inserted somewhere in the middle of the html page rather than the onLoad 
at the end of the document.


Here is what I see... (a simple link to show 'Project')

<a id="id513" onclick="$(&quot;#busy&quot;).show(300)" href="/portal?_s=WKDLJE12tAQicU1u&amp;_k=xlDl3htKPumY6l-A&amp;514" class="ui-draggable" style="position: relative;">Projects</a>


Thanks for the comments,
Bob


On Tuesday, November 11, 2014 1:56 AM, "jtuchel at objektfabrik.de" <jtuchel at objektfabrik.de> wrote:
 


Paul, Bob,

as far as I understand, Bob's problem is not related to #onAjaxStart:, 
because there is no Ajax request in his code example, just a simple 
callback. So what you suggest would show a spinner on each Ajax call, 
but it will not fix the issue at hand, which is that the callback is not 
called.
Or are you saying onAjaxStart: will also be executed for "normal" 
callbacks like anchors and submit buttons? My understanding is it is 
only executed in the context of an XMLHTTPRequest...?

The described behavior, however, is really strange. In the snippet you 
show, there is nothing that would prevent the Browser from handling the 
user's click on the link. So if your code snippet really is the 
production code, I do not see anything that would explain why in some 
cases there is no callback processing. So I don't really have an instant 
answer, just a few ideas:

* Are you sure the callback isn't executed? Did you check with Browser 
tools if a request is sent to the server?
* Does a server side breakpoint in the callback method fire?
* Is it some obscure ancient Browser version (think IE 8 and below) in 
which this happens?
* Is your onClick: handler more complex than your shown snippet? Does it 
return false or call preventDefault() ? This would be the only 
explanation I can see for the callback not executing.
* If these hints don't help, try debugging the resulting Javascript on 
your Browser. All current browsers have quite nice tools for debugging 
javascript. The only difficulty here is that it's sometimes hard to find 
and debug js code that was generated by Seaside, because the code is 
inserted somewhere in the middle of the html page rather than the onLoad 
at the end of the document.

HTH,

Joachim

Am 10.11.14 um 17:12 schrieb Paul DeBruicker:
> Hi Bob,
>
> Using the #onAjaxStart: & #onAjaxStop: setting as discussed here:
> http://forum.world.st/JQAutocomplete-and-onAjaxStart-td4787505.html to
> trigger the busy spinner may fix your issue because it would wait for the
> request to be sent from the client to start the spinner, rather than the
> click.
>
>
>
>
> Paul
>
>
>
>
> Bob Nemec wrote
>> We like to show a 'busy' spinner image when a user clicks on a link.
>> Years ago we added code like this...
>>
>> ...
>>> onClick: ((canvas jQuery id: 'busy') show: 0.3 seconds);
>>> callback: [some action]
>>> ...
>> ...which works fine, except that sometimes the onClick: action gets
>> triggered without the callback:
>> The user then sees the 'busy' image, but the view does not change. They
>> think the system has locked up.
>> I've tried various ajax / onSuccess: mixes, but nothing works exactly
>> right.
>>
>> What would be a good way to ensure that 'busy' is shown only if the
>> callback: block is triggered?
>>
>> Thanks for any help,
>>
>> Bob Nemec
>> HTS
>> _______________________________________________
>> seaside mailing list
>> seaside at .squeakfoundation
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
>
>
> --
> View this message in context: http://forum.world.st/onClick-plus-callback-tp4789445p4789502.html
> Sent from the Seaside General mailing list archive at Nabble.com.
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:jtuchel at objektfabrik.de
Fliederweg 1                        http://www.objektfabrik.de
D-71640 Ludwigsburg                  http://joachimtuchel.wordpress.com
Telefon: +49 7141 56 10 86 0         Fax: +49 7141 56 10 86 1


_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20141111/c217964f/attachment.htm


More information about the seaside mailing list