[Seaside] self request from renderContentOn

Ramon Leon ramon.leon at allresnet.com
Thu Apr 26 01:58:03 UTC 2007


> 
> Hi,
> 
> I don't understand why the following doesn't work:
> 
> renderContentOn: html
>     html heading: (self request: 'Enter a title')
> 
> I've got it working a little more circuitously (using an 
> anchor with a callback to set an instance variable), but I 
> don't understand the error that I get with the above:
> 
> MessageNotUnderstood: UndefinedObject>>isGet
> 
> UndefinedObject(Object)>>doesNotUnderstand: #isGet
> self	nil
> temps
> aMessage	isGet
> 
> ...
> 
> Anyone got some pointers?
> 
> Cheers,
> 
> Patrick

See http://onsmalltalk.com/programming/smalltalk/terse-guide-to-seaside/

Specifically points 1 and two from "A few things to keep in mind"

1. Don't put logic in render methods, a render method should be able to be
called many times without adversely affecting the component

2. Don't call components directly from the render methods of other
components, always make sure any calls are inside #callback: blocks, this
bites every newbie

You're violating both.  Try this instead...

renderContentOn: html
    self someHeading 
        ifNil:[html anchor 
                    callback:[self someHeading: 
                        (self request: 'Enter a title')]
                    with: 'Enter a title'] 
        ifNotNil:[html heading: self someHeading]

self request: calls another component, you cannot do this outside the
context of a callback block unless you are in a WATask which has no UI of
its own.

Ramon Leon
http://onsmalltalk.com



More information about the seaside mailing list