[Glass] How to ensure onSuccess: is sent

Bob Nemec bobn at rogers.com
Mon May 10 12:47:14 PDT 2021

 Submit form conflicts were a problem in the past. I've replaced all the buttons on that view with anchors that look like buttons in order to avoid the enter key default action. But that is a good point: I'll double check that I not missed one.
Here is a little bit more information...  self onKeyPress: ( (JSStream  on: '(window.event ? window.event.keyCode : event.which) == 13') then: (canvas jQuery ajax  callback: aBlock value: canvas jQuery this value; onBeforeSend: (JSStream on: 'console.log("onBeforeSend")'); onSuccess: aScript; onComplete: (JSStream on: 'console.log("complete")')))
...using this code I always see the 'onBeforeSend' in the log, and the callback is always triggered, but 'complete' is never displayed (I was not using onComplete: ... just a curiosity). I also have console.log() code in the onSuccess: script and it is consistent with the refresh rendering. i.e. it is not a case of the (html jQuery id: 'divToBeRefreshed') load html: [:r | ...] ) being sent but not happening. The success script is just not happening. 
Is there a place I can insert a trace for the callback result code? 
Although I would think that a bad callback result would show the same symptom on a single gem configuration as well, which it does not.
    On Monday, May 10, 2021, 03:16:15 p.m. EDT, jtuchel--- via Glass <glass at lists.gemtalksystems.com> wrote:  
  two questions out of the blue: 
   - did you make sure the ajax request is a success in all cases (HTTP 200)?
   - sounds a bit like the submit event of a surrounding form might sometimes get in your way. Is that possible? Are you sure it is not the case?

Maybe both are completely pointless, just brainstorming
  Am 10.05.21 um 20:21 schrieb Bob Nemec via Glass:
   I've posted this question on the PharoJS Seaside forum and on stackoverflow, asking about onSuccess: not working correctly after a callback. In a text input field, if the user presses the [Enter] key we run this code... 
    html jQuery ajax         callback: [:value | self doSearchWith: value] value: html jQuery this value;
          onSuccess: ((html jQuery id: 'fieldId') load html: [:h | ...div to be rendered after search... ])
  The intermittent symptom is that the user enters a value, presses [Enter]. The entered value reverts back to the previous value and the search result does not change. At first I thought the problem was that the onSuccess: script was being sent before the callback, but, after reading the gem logs more carefully, the problem turns out to be that the onSuccess: script is not run at all. The only place I run multiple web servers is in our GS + HAProxy setup. There is never a problem with one gem or in VW.
  If I add 'async: false' then the onSuccess: script always runs. But while the callback is running, the user sees no feedback. For most user actions I show a busy gif and a 10% opaque overlay. Neither of those work with 'async: false' because all display rendering held up.  
  Any suggestions for how I can ensure a onSuccess: script runs after a callback?  
  I understand that onSuccess: depends on the HTTP response code, but the callback action is always successful.  
 Thanks for any help, Bob Nemec    
Glass mailing list
Glass at lists.gemtalksystems.com

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

Glass mailing list
Glass at lists.gemtalksystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gemtalksystems.com/mailman/private/glass/attachments/20210510/ce04d9bf/attachment-0001.htm>

More information about the Glass mailing list