[Seaside] style CSS and liveCallback

Michel Bany m.bany at wanadoo.fr
Tue Apr 11 05:48:48 UTC 2006

>       I have a liveCallback on a select tag. When any element  is 
> selected on this tag, I want change Style. I noticed when I perform a 
> submission of the form, the #style method is called, so CSS is 
> applied, but when I used liveCallbak, that doesn't happen.
> How could I update the CSS code when I'm using liveCallback?
> I am working with  Seaside2.5b8-mb.15/Squeak3.7.
The #style methods are not called during execution of  live callbacks.
Even if they were, their corresponding values would not be used,
since the live callback Javascript does not handle the html head
elements. Processing them, i.e. download the stylesheets and apply
the styles would be quite a challenge.

There might be a way though, to achieve what you are looking for.
The code below is written using the email editor, therefore untested

1) Add new methods to your component

renderStyleOn: html
    html attributes id: 'live-styles'.
    html tag: 'style' do: self liveStyle.

    ^ whatever styles need to be changed by live callbacks

2) Call the first method from your rendering method, must be at the end.

3) Call it also from your live callbacks. The live callback Javascript will
live-update the style element.

4) Pray for the browser to update the styles when the style element is
live-updated. Some browsers may, some other may not.


More information about the Seaside mailing list