[Seaside] How to stop periodical, end a polling mechanism... again

Julien Berthaud j.berthaud at aureo.info
Fri Jul 6 09:58:02 UTC 2007


I have followed your thread which is quite interesting.
I have successfully followed the advices Lukas provided.
>>
>> It's so frustrating!!
It's so amazing when it works !!!
>
> I copy and pasted your example. I fixed it according to my previous
> mail and it works. As a response you should only get:
>
>  <script 
> type="text/javascript">/*<![CDATA[*/periodical.stop()/*]]>*/</script>
>
> Nothing else, especially no <head> and <body> tags.
>
Indeed, no <head> and <body> tags in the response.
But I had both of these tags due to the #evalScripts: not at the right 
place.
As Lukas suggested, I am on an older version of Scriptaculous and I 
needed #evalScripts: set to true but on the OUTER updater.

Here is the code:

html div id: 'time'.
                            (html submitButton)
                                onClick: ((html periodical)
                                            id: 'time';
                                            *evalScripts: true;*
                                            frequency: 1 second;
                                            assignTo: 'periodical';
                                            callback:
                                                    [:r |
                                                    (DateAndTime now - 
(start ifNil: [start := DateAndTime now])) seconds > 10 "#sample criteria#"
                                                        ifTrue:
                                                            [r script: 
((r periodical)
                                                                        
alias: 'periodical'; "evalScripts: true; should not be there according 
to Lukas' advise"
                                                                        
call: 'stop').
                                                            start := nil]
                                                        ifFalse: [r 
render: DateAndTime now - start]]);
                                text: 'Start'.
> Lukas
>
Thank you Folks,
Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070706/06bf9556/attachment.htm


More information about the Seaside mailing list