[Seaside] script: [...] value parameter

Johan Brichau johan at inceptive.be
Mon Oct 24 07:08:14 UTC 2022


I copy/paste my response on the Discord channel:

An ajax request with Seaside JQuery can combine multiple secondary callbacks and a single primary callback. You can find out which are which in the method comments on JQAjax. In short: a primary callback is a response-generating callback, while secondary callbacks are callbacks that pass values from the client to the server. 
As such, you can construct what you want already as follows:
| value |
html jQuery ajax 
   callback: [ :v | value := v ] value: (html jQuery this propertyAt: 'id');
   script: [ :s | ...use value in the generation of the script... ]




[9:40 AM]
Also, take a look at passengers if you want to store objects and retrieve them by id. Seaside has this mechanism built-in for you:
| value |
html button
   passenger: self;
   onClick: (html jQuery ajax 
       callback: [ :v | value := v ] passenger: (html jQuery this);


> On 21 Oct 2022, at 19:48, Bob Nemec <bobn at rogers.com> wrote:
> 
> Cross posted from Seaside Discord channel...
> 
> I would like to have an 'html ajax script: [...]' method that has a callback:value: pattern. 
> 
> Something like... 
>     html ajax script: [:script :value | ...] value: (html jQuery this propertyAt: 'id') 
> 
> Then in the script block 'value' would get the id of 'this', which in an ajax callback is undefined. 
> This would allow server code to use browser information to build the script. 
> 
> Anyone done this?
> 
> 
> Bob Nemec
> 
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/seaside/attachments/20221024/5d39f992/attachment.html>


More information about the seaside mailing list