[英]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.