[英]how to add a “next fieldset” button to an add/edit form for a Dexterity Plone type
[英]How to hide a fieldset (tab) in Plone add/edit form
我在dexterity内容类型中有一些代码,如下所示:
form.fieldset(
'transitionsLog',
label=_(u"Transitions Log"),
fields=['t_log']
)
form.mode(t_log='hidden')
t_log = schema.TextLine(
title=_(u'Transitions log'),
)
在添加/编辑表单中,字段t_log隐藏但字段集选项卡“转换日志”仍显示在表单中,如上所示...
我不知道在添加/编辑表单中隐藏“过渡日志”选项卡,
我能怎么做 ?
由于字段仍以隐藏模式呈现,因此字段集仍然存在。
如果要完全省略字段集,则需要省略字段集中的所有字段。 这可以使用omitted
指令form.omitted
来实现。
form.fieldset(
'transitionsLog',
label=_(u"Transitions Log"),
fields=['t_log']
)
form.omitted('t_log') # This will also omit your fieldset
t_log = schema.TextLine(
title=_(u'Transitions log'),
)
我在下面找到了一个正确的方法,在自定义添加/编辑表单中省略了字段:
from plone.z3cform.fieldsets.utils import remove
...
def updateWidgets(self):
remove(self, 't_log')
super(CustomEditForm, self).updateWidgets()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.