[Seaside] Dumb newbie problem with repeating a call/answer

Ramon Leon rleon at insario.com
Wed Feb 22 22:09:47 UTC 2006


> so, one could have a, say, a HOME button that would be a method?
> don't know how to make it go back "Home", but:
> 
> ----
> homeButton
> 
> (html anchor)
>   id: 'homeButton';
>   onClick: [];
>   callback:[];
>   liveCallback:[];
>   text: 'Home'.

Don't set props you don't need, maybe I wasn't clear, use only what you
want, ie..

 (html anchor)
   callback:[self goHome];
   text: 'Home'.

And you'd write goHome to do whatever you want.  Or a button like...

 (html submitButton)
   callback:[self save];
   text: 'Save'.

Or...

 (html submitButton)
   on: #save of: self;
   text: 'Save'.

on:of: is a common thing when doing a callback on a method of an object,
handy shortcut.  Maybe you want to style this button so you give it an
id...

 (html submitButton)
   on: #save of: self;
   id: 'SaveButton';
   text: 'Save'.

Or maybe a class...

 (html submitButton)
   on: #save of: self;
   class: 'Button';
   text: 'Save'.

The whole point of the canvas api is to allow you to set any combination
of props you want on a tag by using cascades instead of specialized
methods.  The old api suffered from a combinatorial explosion of special
methods, the new one can't.


More information about the Seaside mailing list