[Zope3-Users] Formlib, AddForm, raising error in method create

Darryl Cousins darryl at darrylcousins.net.nz
Tue Jul 18 23:21:34 EDT 2006


Hi All,

I am trying to find a way to raise an error in the 'createAndAdd' method
after checking for duplicate names in the container and return the user
to the form for correction if the name is a duplicate.

I've tried this in the createAndAdd method::

        if True:
            error_msg = _("Duplicate username: ${username}", \
                        mapping={'username':username})
            self.errors = (error_msg,)
            result = self.actions['form.actions.add'].failure(data,
self.errors)
            self.form_result = result
            return

This gets me back to the form, but all fields have been reset. All else
that I have tried has come to nought.

Any suggestions?

Darryl




More information about the Zope3-users mailing list