我正在尝试在我的dexterity内容类型上创建一个自定义的add表单。我已经按照此链接的说明进行了操作:http://plone.org/products/dexterity/documentation/manual/developer-manual/advanced/forms
在我的内容类型中:
class BusinessTransactionFormAddForm(dexterity.AddForm):
grok.name('ebpls.app.businesstransactionform')对于我的模板,businesstransactionformaddform.pt我使用了这个链接中的布局:http://dexterity-developer-manual.readthedocs.org:8000/en/latest/schema-driven-forms/customising-form-presentation/layout-templates.html
我之所以想定制add表单,是因为我想插入从DataGrid字段计算值的jQuery。插入javascript没有问题。唯一的问题是,在网页上,它创建了两个表单,分别位于上下两个位置,即在另一个的底部复制了相同类型的字段。我使用的模板有什么问题吗?有人知道添加视图的正确模板是什么吗?谢谢!
发布于 2012-11-24 03:15:45
Dexterity假设add form的模板只用于表单,而不是整个页面-因此它采用表单模板并将其包装在另一个使用main_template的模板中。
由于您的自定义模板确实呈现了整个页面,因此您应该使用form.wrap指令关闭包装:
from five import grok
from plone.directives import form
from plone.directives import dexterity
class BusinessTransactionFormAddForm(dexterity.AddForm):
grok.name('ebpls.app.businesstransactionform')
form.wrap(False)https://stackoverflow.com/questions/13523486
复制相似问题