from plone import api
from plone import schema
from plone.autoform.form import AutoExtensibleForm
from z3c.form import button, form
from zope.interface import Interface
name = schema.TextLine(title = "Your Name"
class MyForm(AutoExtensibleForm, form.EditForm):
schema = IMyForm
ignoreContext = True
label="What's your name?"
description = "Simpe, sample form"
def handleApply(self, action):
data, errors = self.extractData()
self.status = self.formErrorsMessage
changes = self.applyChanges(data)
self.status = "Settings changed"
def handleCancel(self, action):
z = 0
y = 4 / z
The only real differences are I don't have the layer parameter for where I have the browser:page in configure.zcml and I have code to redirect to the front page in cancel.
When I click cancel, instead of redirecting to the front page, the name field gets an error message "Please fill out this field" and the cancel handler function isn't actually called. I tried a print statement and that didn't print in the terminal. I did try dividing by zero to trigger an error, but that was ignored.
Is it because I don't have the layer parameter in configure.zcml?
The cancel button is working in other forms. I went to add a Folder and clicked 'Cancel' and that worked as it should.