Hi,
i have a Form:
# Schema Definition of Form
class ITestSelectWidgetForm(model.Schema):
directives.widget('jobcategories', CheckBoxFieldWidget, klass="cat")
jobcategories = schema.Choice(
title=_(u'Berufsfeld'),
description=_(u'Bitte wählen Sie aus den Möglichkeiten die zutreffenden aus.'),
vocabulary="my.jobabo.jobcategories"
)
directives.widget('sub1', CheckBoxFieldWidget, klass="sub sub1")
sub1 = schema.Set(
title=_(u'Berufsfeld einschränken'),
description=_(u'Bitte wählen Sie aus den Möglichkeiten die zutreffenden aus.'),
value_type=schema.Choice(
vocabulary="my.jobabo.jobabosubcategory1"
)
)
# and much more fields
# ......
# The Form
class TestSelectWidgetForm(AutoExtensibleForm, form.Form):
schema = ITestSelectWidgetForm
ignoreContext = True
label = _(u"Criteria")
description = _(u"")
output = None
def __init__(self, context, request):
super(TestSelectWidgetForm, self).__init__(context, request)
self.context = context
self.request = request
def updateFields(self):
logger.info("in updateFields")
super(TestSelectWidgetForm, self).updateFields()
def updateWidgets(self):
logger.info("in updateWidgets")
super(TestSelectWidgetForm, self).updateWidgets()
def updateActions(self):
logger.info("in updateActions")
super(TestSelectWidgetForm, self).updateActions()
def update(self):
logger.info("in update")
super(TestSelectWidgetForm, self).update()
@button.buttonAndHandler(u'Ok')
def handleApply(self, action):
logger.info("in handleApply")
data, errors = self.extractData()
if errors:
# TODO Handle the Errors
self.output = False
return
self.output = True
self.status = "Thank you very much!"
@button.buttonAndHandler(u"Cancel")
def handleCancel(self, action):
logger.info("in handleCancel")
# The View
TestSelectWidgetFormView = wrap_form(TestSelectWidgetForm, index=FiveViewPageTemplateFile("templates/form-jobabo.pt")
and the Form-Wrapper-Template:
<html metal:use-macro="context/main_template/macros/master"
i18n:domain="my.jobabo">
<body>
<metal:block fill-slot="main">
<h1 class="documentFirstHeading" tal:content="view/label | nothing" />
<div id="content-core">
<div
id="form-input"
tal:condition="not:view/form_instance/output">
<span tal:replace="structure view/contents" />
</div>
<div
id="form-output"
tal:condition="view/form_instance/output">
<h1>here is the output</h1>
</div>
</div>
<script type="text/javascript">
// Plone 4:
$('.z3cformInlineValidation').removeClass('z3cformInlineValidation');
// Plone 5:
$('.pat-inlinevalidation').removeClass('pat-inlinevalidation');
</script>
</metal:block>
</body>
</html>
I have found only this way to disable the pat-inlinevalidation
Pattern. Is there a simpler way to achieve the goal? I think this is to heavy, if i register an Extra-Template only for two Lines of JS code.
best regards, Jan