For the [Seaside] FAQ: Making the back button work

Philippe Marschall philippe.marschall at
Mon Dec 31 11:08:27 UTC 2007

2007/12/31, Tom Phoenix <rootbeer at>:
> On Dec 30, 2007 2:39 PM, Philippe Marschall
> <philippe.marschall at> wrote:
> > [...] if the value
> > of #children changes over time you need to use backtracking to make
> > sure the back button works correctly.
> What do I need to do to make sure the back button works correctly in
> my application?
> I'm not asking about an actual application; this is a question for the
> FAQ. But I am asking for more explication; exactly how does one do
> this? It's not clear to me what should happen, for example, if one of
> the items returned by #children is no longer intended to be rendered;
> does it need to stay in #children in case the back button might cause
> it to be rendered once again?
> In particular, does handling the back button depend upon the
> application? The page on "Maintaining State" in the documentation
> section on gives a (slightly broken) example, but one
> which contrasts with WACounter's way, thereby implying that there is
> more than one way for an application to handle the back button. What
> different ways are useful and supported?

You need to tell Seaside which objects need to be backtracked and let
Seaside the backtracking for you. Which objects need to be backtracked
depends on your application. How you tell Seaside to backtrack an
object depends on your Seaside version. In <= 2.7 you send
#registerObjectForBacktracking: to your session, in 2.8 you return
#states in your component.

to go back to the example of Randal:

   super initialize.
   body := self body1. "set up the initial component"

   ^ Array with: body. "don't forget this!"

 renderContentOn: html
   html anchor callback: [body := self body1]; with: 'first body'.
   html anchor callback: [body := self body2]; with: 'second body'.
   html render: body. "render the current body"

In this case you would have to implement

    ^Array with: self

Because the contents of self (the content of the body instance
variable) changes ower time and needs to be backtracked. Else you
could use the back button to go to a state where a different body was

in Seaside <= 2.7 you would do:

   super initialize.
   body := self body1. "set up the initial component"
   self session registerObjectForBacktracking: self


More information about the seaside mailing list