Temporary variable for callback

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Temporary variable for callback

Damien Cassou-3
Hi,

I thought code like this used to work:

TestComponent>>renderContentOn: html
     | firstname |
     html form:
        [html textInput
              callback: [:value | firstname := value].
     html submitButton
              callback: [self inform: 'Hello ' , firstname]].


But it seems it is not the case ; when the callback of submit button is
executed, firstname is nil. However, a 'self halt' in the callback of
textInput shows that firstname is changed correctly. I use
Seaside2.7a1-pmm.134 (last version).

If I change the temporary to an instance variable, the problem disapear
and it works perfectly.

Thank you
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Temporary variable for callback

Michel Bany-3
Damien Cassou a écrit :

> Hi,
>
> I thought code like this used to work:
>
> TestComponent>>renderContentOn: html
>     | firstname |
>     html form:
>        [html textInput
>              callback: [:value | firstname := value].
>     html submitButton
>              callback: [self inform: 'Hello ' , firstname]].
>
>
> But it seems it is not the case ; when the callback of submit button
> is executed, firstname is nil. However, a 'self halt' in the callback
> of textInput shows that firstname is changed correctly. I use
> Seaside2.7a1-pmm.134 (last version).
>
> If I change the temporary to an instance variable, the problem
> disapear and it works perfectly.
Hi Damien,

Your code would work fine in VW.

This issue has already been discussed in details
see
http://lists.squeakfoundation.org/pipermail/seaside/2006-February/006706.html

Cheers,
Michel.

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Temporary variable for callback

Yanni Chiu
In reply to this post by Damien Cassou-3
Damien Cassou wrote:
> If I change the temporary to an instance variable, the problem disapear
> and it works perfectly.

IIRC, it's always behaved this way. Making it an
instance var. instead of a method temp. will get
you the expected result. Have you tried sending
#fixCallbackTemps (a.k.a. #fixTemps to the textInput
callback?

_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: Temporary variable for callback

Damien Cassou-3
In reply to this post by Michel Bany-3
Thanks to both of you.
_______________________________________________
Seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside