[Seaside] Callback onError: management

Dario Romano Trussardi dario.trussardi65 at gmail.com
Thu Jul 9 19:08:14 UTC 2020


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 ]
							 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]]

***
	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' 

	
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20200709/7ad7aa51/attachment-0001.html>


More information about the seaside mailing list