I have a Plone custom control panel registry and I'm trying to use a well know method to customize some of the widgets properties for zope.schema.Text
and zope.schema.TextField
.
I commonly customize the updateWidgets
in that way:
def updateWidgets(self):
super(MyEditForm, self).updateWidgets()
self.widgets['my_text_area'].style = 'width: 100%'
self.widgets['my_text_area'].rows = 7
But now I'm working on a form where fields are splitted in two fieldsets:
class MySettingsEditForm(controlpanel.RegistryEditForm):
schema = IMySettingsSchema
groups = (Form1, Form2)
# fields = nothing
If I try to access self.widgets['my_text_area']
I get KeyError
. It seems that as I did't defined the fields
attribute I can't access directly widgets.
I found that I have groups
so I can call something like self.groups[0].fields['my_text_area']
but still I find no way to access widgets for fields inside groups.
How can I customize widgets attributes when using groups?
I think what you need is playing with widget subform, see this code: