On Thu, Sep 14, 2006 at 02:34:59PM +0200, Stefan Fink wrote:
> Hi list,
> how is it possible to add multiple actions per button to formlib forms?
> Actually I'm trying to create a button which:
>  - applies all changes made in the form
>  - takes the user back to the container view
> class GeneralEditForm(formlib.form.EditForm):
>     ...
>     # this does not work
>     @formlib.form.action(u'Apply&Close')
>     def handle_applyAndClose(self, action, data):
>         """ apply form changes and close form."""
>         self.handle_edit_action(action, data)

You didn't include how you define handle_edit_action, but I assume you
use @formlib.form.action here as well:

    def handle_edit_action(self, action, data):

What this code does is to create a new Action object, having the
handle_edit_action method as its success method. This action will be
added to self.actions, but more importantly, this action will also be
assigned to self.handle_edit_action. So in your handle_applyAndClose
method above, self.handle_edit_action isn't a method, it's an Action
object. (c.f the way @property works). So in order to call your edit
action you need to do:



Zope3-users mailing list

Reply via email to