[Zope3-Users] Re: Specifying form appearance
Philipp von Weitershausen
philipp at weitershausen.de
Fri Apr 28 17:28:10 EDT 2006
Graham Stratton wrote:
> I'm sure this is completely obvious, since no one else has mentioned it
> anywhere, but I can't figure out what I'm meant to do.
>
> All I want to do is to beautify my formlib form. I've created my own
> template, and laid things out as I want, and rendered the widgets
> individually by name. What I can't work out how to do is to change the
> size of the text boxes. I'd have guessed that the place this should be
> done is in the page template, but I can't see how I can set
> widget.displayWidth from there.
>
> Can someone please help me?
You could do it in the Page Template, but easier (not necessarily nicer)
way of doing it is directly in the Form implementation:
class FooEditForm(EditForm):
form_fields = Fields(IFoo)
...
def setUpWidgets(self, ignore_request=False):
# set up widgets, they will be in self.widgets
super(FooEditForm, self).setUpWidgets(ignore_request)
self.widgets['my_field'].displayWidth = 10
self.widgets['another_field'].css_class = 'bla'
etc.
Philipp
More information about the Zope3-users
mailing list