[Grok-dev] How to create Cancel that doesn't validate form in grok.EditForm

Andreas Kaiser kaiser at xo7.de
Thu Dec 11 08:56:24 EST 2008


Sebastian Ware wrote:

> In a grok.EditForm, how do I mark an action so it doesn't require
> validation of the form?
>
> I am thinking about the use case "cancel". I don't want to get error
> messages due to invalid input if I choose the "cancel" action.

I don't know if it applies to grok.EditForm as well, but this is what  
I've done with a grok.Form:

     @grok.action('Cancel', validator=lambda *args, **kwargs: {})
     def cancel(self, **data):
         self.redirect(self.application_url())


HTH,

Andreas


More information about the Grok-dev mailing list