[Seaside] Generating an URL for a callback

Kum Sackey ke.sackey at gmail.com
Wed Jun 11 11:00:47 UTC 2008

I've had the same problem before. The following code should work for
returning the URL for a callback block:

>> callbackUrlFor: aBlock on: html
 | updater callbackKey url |
 updater := html updater callback: aBlock.
 callbackKey := html callbacks registerAjaxCallback: [updater process].
 url := html context actionUrl withParameter: callbackKey.
 ^ url

Then you can use it in your render like this....

>> renderContentOn: html

| callbackUrl |

callbackUrl := self callbackUrlFor: [:r | r text: 'Example!' ] on: html.

html anchor class: 'jTip'; id: 'element-id'; url: callbackUrl; with: 'Mouse
over for tooltip'.

K. Sackey

Cloud Nine

> I'm porting an app to seaside that is using jTip
> (http://www.codylindley.com/blogstuff/js/jtip/) to handle tooltips.
> jTip works on links like the one below
> <a id="element-id" class="jTip" href="/callback-url?width=450">Mouse
> over for tooltip</a>
> where callback-url will return the html to render as the tooltip. How
> do I generate the callback-url?
> Searching the archives, the closest I could find was a snippet like:
> html updater
>   callback: [ :r | r render: 'bar' ];
>   url.
> However, this just evaluates to http://localhost:8080/seaside/myapp
> Any help would be appreciated.
> Thanks,
> Wilkes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080611/57383828/attachment.htm

More information about the seaside mailing list