[Seaside] onSuccess: problem

Lukas Renggli renggli at gmail.com
Sat May 10 08:44:12 UTC 2008

>  Then you'll see how to use SUStream manually to feed hand written JavaScript
>  into #onSuccess:.  Scriptaculous events like #onSuccess: do not work like
>  Seaside events like #onClick: or #onChange:.  Seaside events assume they're
>  being handed JavaScript and they just run whatever you give them, but
>  Scriptaculous events call #asFunction on whatever you give them, so when you
>  give them a string, they wrap a function around it...
>  function(){'window.alert("Failure")'}

The reason for this is that Scriptaculous "translates" Smalltalk to
JavaScript. If you put a string literal into a JavaScript object it is
transformed to a JavaScript string with the propre escaping of special
chars, etc.

As Ramon pointed out you need SUStream to tell a stream to be emitted verbatim.

Personally I prefer the logging framework built into all modern
webbrowser (Safari, FireFox) over using "alert()". It is not only more
convenient to get the message, but also much simpler to use:

    onSuccess: (html logger errror: 'Failure')

There are many other variateions. See the SULogger class.


Lukas Renggli

More information about the seaside mailing list