[Zope3-Users] Re: Specifying form appearance

2006-04-28 Thread Rocky Burt
On Fri, 2006-28-04 at 21:03 +0100, 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.

I'm not experienced with formlib myself but I would expect the
easiest/cleanest way of changing the width of the text fields would be
by using a CSS stylesheet.

- Rocky


-- 
Rocky Burt
ServerZen Software -- http://www.serverzen.com
News About The Server -- http://www.serverzen.net


___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] Re: Specifying form appearance

2006-04-28 Thread Philipp von Weitershausen
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

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users