How to hide a field (tab) in the form of adding / editing Plone

I have some code in the agility content type as below:

form.fieldset( 'transitionsLog', label=_(u"Transitions Log"), fields=['t_log'] ) form.mode(t_log='hidden') t_log = schema.TextLine( title=_(u'Transitions log'), ) 

Hide the t_log field in the add / edit form, but the tab for the Transition Log field set of fields is still displayed in the form, as described above ... enter image description here

I’m not going to hide the Transitions tab in the add / edit form,

How can i do this?

+5
source share
2 answers

Because the fields are still displayed in stealth, a set of fields still exists.

If you want to completely omit the field set, you need to omit all the fields in the field set. This can be achieved using the omitted form.omitted directive.

 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'), ) 
+6
source

I found the correct path, as shown below, for the omitted field in a custom add / edit form:

 from plone.z3cform.fieldsets.utils import remove ... def updateWidgets(self): remove(self, 't_log') super(CustomEditForm, self).updateWidgets() 
+1
source

All Articles