[Seaside] Disabling the back button

Ramon Leon ramonleon at cox.net
Sat Sep 23 04:50:38 UTC 2006

> Thanks.  I read the document.  Looks like a slight API change since the
> isolate: method has moved from WASession to WAComponent.  That aside, I
> decided to test this by adding the technique to the WACounter example class.
> Here are the methods I changed:
> increase
>  self isolate: [ count := count + 1 ]
> decrease
>   self isolate: [ count = 0
>     ifFalse: [count := count - 1]
>     ifTrue:
>         [(self confirm: 'Do you want to go negative?')
>                ifTrue: [self inform: 'Ok, let''s go negative!'.
>              count := -100]]].
> The example seems to behave exactly as without the isolate: code.  I can use
> the back button and then click on ++ or --.  They work as before.  Ideas?
> -Carl Gundel, author of Liberty BASIC
> http://www.libertybasic.com

I think you misunderstand the intent of isolate.  You can't isolate 
individual actions in a callback, rather you isolate the viewing of a 
component.  Trying using it from a WATask subclass to coordinate 
workflow and prevent a user from going back in the flow.

Consider the sample in the WAStoreTask

     | shipping billing creditCard |
     cart := WAStoreCart new.
     self isolate:
         [[self fillCart.
         self confirmContentsOfCart]

     self isolate:
         [shipping := self getShippingAddress.
         billing := (self useAsBillingAddress: shipping)
                     ifFalse: [self getBillingAddress]
                     ifTrue: [shipping].
         creditCard := self getPaymentInfo.
         self shipTo: shipping billTo: billing payWith: creditCard].

     self displayConfirmation.

#isolate: is used to wrap what is essentially #call: to several 
components in succession.  You could use isolate in a callback, if the 
callback is calling another component to display, but not if it's just 
setting instance variables.

The point is, all isolate does is expire any components created within 
the block passed to it, when the execution of the block is complete. 
Once execution has passed beyond the isolate block, the user cannot go 
back to any component called from within the block.

More information about the Seaside mailing list