[Seaside][SeasiedAsync] Capturing events
m.bany at wanadoo.fr
Fri Mar 31 08:42:16 UTC 2006
The other day a customer of mine came with an interesting request.
They wanted to know what field on the page had the focus just before
a button was clicked and a new component called.
Their idea was to restore the focus to that field when returning from the
called component, possibly with the cursor placed at the right position.
After some discussion, we thought of reusing the SeasideAsync framework
It works with both "canvas" and "classic" Seaside with the following api :
(pardon the possible mistakes in these examples)
html onFocusCallback: [:event :renderer | lastFocus := 'field-1'].
html textInputWithValue: field1 callback: [:v | field1 := v].
onFocusCallback: [:event :renderer | lastFocus := 'field-1'];
callback: [:v | field1 := v].
turned into an instance of WALiveEvent with a bunch of properties,
and the event object is passed to the callback. A renderer is also made
available so that the application can modify portions of the page.
This is available at squeaksource.com/Seaside as SeasideAsync-mb.31
and requires Seaside 2.6b1. This is pretty much untested, and this is the
reason for this post. I would appreciate if interested people would give it
a try and let me know how it goes.
Meanwhile, I'll have a look to the cursor issue ...
More information about the Seaside