[Seaside] Answer Handlers - Multiple?
Sean P. DeNigris
sean at clipperadams.com
Sat Jun 30 00:31:32 UTC 2018
Esteban A. Maringolo wrote
> What would be the use case of such multiple handlers?
I have a Magritte form for a Command object. I wanted to execute the command
during #save, which is implemented like this:
...
self commit; answer: self model
I needed to execute after the commit but before the component answers. I
tried with an #onAnswer: block, but that prevented the normal answering, so
I ended up basically copy/pasting to:
MyModelObject>>#loginVia: aWAComponent
"This is pretty much what #save-ing the Magritte form does, but there was
no apparent hook to set the user"
...
aWAComponent commit.
self ifUserAuthenticated: [ :usr | aWAComponent session user: usr ].
aWAComponent answer
And then:
MyModelObject>>#asComponent
^ super asComponent
addValidatedForm: { [ :comp | self loginVia: comp ] -> 'Login' };
yourself
-----
Cheers,
Sean
--
Sent from: http://forum.world.st/Seaside-General-f86180.html
More information about the seaside
mailing list