onClick: plus callback:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

onClick: plus callback:

Bob Nemec
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

jtuchel
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@.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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

Bob Nemec
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, "[hidden email]" <[hidden email]> 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
>> [hidden email]
>> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

Bob Arning-2
could it be that draggable elements behave differently depending on whether you actually move the mouse after clicking or not?

On 11/11/14 9:46 AM, [hidden email] wrote:
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>



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

jtuchel
In reply to this post by Bob Nemec
Bob,

your code looks fine, no obvious problem here... apart from the fact that your link has a class of ui-draggable. It is very likely the code that hooks into clicking the link to start dragging the link does some kind of suppressing the handling of the click event after it did its job. I guess it does a preventDefault() after it started drag processing.

So the first thing I'd try is to remove the .ui-draggable class and see what happens.

HTH

Joachim

 

Am 11.11.14 um 15:46 schrieb [hidden email]:
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, [hidden email] [hidden email] 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
>> [hidden email]
>> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          [hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: onClick: plus callback:

Bob Nemec
Joachim,
Nice catch... ui-draggable is indeed the problem. 

I wonder if moving the mouse a bit during the click with ui-draggable causes the problem.
I can work around this.

Thanks,
Bob



On Tuesday, November 11, 2014 10:22 AM, "[hidden email]" <[hidden email]> wrote:


Bob,

your code looks fine, no obvious problem here... apart from the fact that your link has a class of ui-draggable. It is very likely the code that hooks into clicking the link to start dragging the link does some kind of suppressing the handling of the click event after it did its job. I guess it does a preventDefault() after it started drag processing.

So the first thing I'd try is to remove the .ui-draggable class and see what happens.

HTH

Joachim

 

Am 11.11.14 um 15:46 schrieb [hidden email]:
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, [hidden email] [hidden email] 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
>> [hidden email]
>> 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
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>


--
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          mailto:[hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside




_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


-- 
-----------------------------------------------------------------------
Objektfabrik Joachim Tuchel          [hidden email]
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
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside



_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Bob Nemec