[Seaside] Lazy callbacks

Avi Bryant avi at beta4.com
Sat Sep 6 14:45:53 CEST 2003


On Sat, 6 Sep 2003, [iso-8859-1] Hern=E1n Galante wrote:

> Hi all!
> =09I'm making an application which tracks all the messages that are
> sent to the model and they are stored in a collection. So I can know all
> the messages that were sent to a particular object at a time and by
> whom. So this kind of track made a good security policy ;-)
> But (always there's a problem :() I found that seaside evaluates all the
> callbacks causing a sent of messages that are innecesary. So I enhanced
> the inteligence of the callback of a text input wrapping the
> callbackBlock with another block which check whether the value was
> changed or not.
> What do you think of this? Can we extent this to all the callbacks?
>
> textInputWithValue: anObject callback: callbackBlock
> =09" Append an input text to the receiver."
>
> =09| callback |
> =09callback :=3D [ :value | value =3D anObject ifFalse: [ callbackBlock
> value: value ]].
> =09self
> =09=09valueInputOfType: 'text'
> =09=09value: anObject
> =09=09callback: callback

I don't think we can do this for the general
#textInputWithValue:callback:, since there's nothing to say that the value
and callback are related to that degree.  For example, I sometimes
do something like this:

html textInputWithValue: '' callback: [:v | someVar :=3D v].

In that case I would still want someVar to be set to '' if the form was
submitted with an empty text input.

However, this would indeed make sense for #textInputOn:of: and similar
methods.  I'd be willing to integrate a patch that made this change for
those methods.

Avi



More information about the Seaside mailing list