Re: Callback onError: management
Esteban Maringolo <[email protected]> Fri, 10 Jul 2020 13:01:54 -0300
| Newsgroups | gmane.comp.lang.smalltalk.squeak.seaside |
|---|---|
| Message-ID | <CAJMgPCJmFFuQG+M-pHNLhAzB7z_fKgqJoMmiQtx9LTynB6AFiQ@mail.gmail.com> |
Hi Dario, In both of my replies I typed the code without checking it other than visually with the Gmail editor that doesn't support tabs... So here I attach a component that does what you need, which I effectively tested. :-) So file it in, and then include it in your application or register it as application as follows: (WAAdmin register: WAApplication at: 'dario') ifNotNil: [ :app | WAAdmin configureNewApplication: app. app preferenceAt: #rootClass put: WADarioComponent ]. Regards! Esteban A. Maringolo On Fri, Jul 10, 2020 at 12:25 PM Dario Romano Trussardi <[email protected]> wrote: > > Ciao, > > i do some test but i have not solved the problem. > > Now i do some test adding some code to WAWelcome … application to check everything again and maybe share the problem... > > With the last code reporting I have defined the following behaviors: > > POINT A) When I generate the error in the callback method, the system enters in the relative block > > html jQuery ajax callback:[ [ self setupCashCartNominativeFor: aName ] > on: Error do:[ self requestContext respond:[ :r | r internalError respond ]]]; > > POINT B) The code: > > onError: ( script << ( script jQuery: #genericErrorDialogId ) dialog open); > it is always activated even if no error is generated > as if the ajax request always returned an error…. > > > Thanks for considerations. > Dario > > Ciao, > > > > Sorry, in my previous email I didn't notice the onSuccess: wasn't sent > to the right object > > html anchor > onClick: ( > (html jQuery ajax) callback: [ > [ self setupCashCartNominativeFor: aName ] on: Error do: [ self > requestContext respond: [ :r | r internalError respond ] > ]; > onError: ( script <<( script jQuery: #genericErrorDialogId ) dialog open ); > onSuccess: ( script << (script jQuery: #idContentView) load > html:[:h| self renderContentViewOn: h])); > with:[ html div class: class; with:[ html paragraph: aName greaseString]] > > > following the above code I deduced the following code: > > html anchor > onClick: ( html jQuery ajax script:[ :script | > script << html jQuery ajax callback:[ > [ self setupCashCartNominativeFor: aName ] > > > POINT A) > > on: Error do:[ self requestContext respond:[ :r | r internalError respond ]]]; > > onError: ( script << ( script jQuery: #genericErrorDialogId ) dialog open); > > POINT B) > > onSuccess:( script << (script jQuery: #idContentView) load html:[:h| self renderContentViewOn: h ])]); > > with:[ html div class: class; with:[ html paragraph: aName greaseString]] > > *** > With this code the onError : ( script jQuery: #genericErrorDialogId ) dialog open) > is open at any click even if the [ self setupCashCartNominativeFor: aName ] don’t signal error. > > Thanks, > > Dario > > P.S. In the method self setupCashCartNominativeFor: aName > > when needed I signal error with a simple code : Error signal: ‘error' > > > _______________________________________________ > seaside mailing list > [email protected] > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside _______________________________________________ seaside mailing list [email protected] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
WADarioComponent.st
(application/octet-stream, 1.5 KB) - not displayed