[Zope3-Users] Arranging widgets in a form / Limit size of input fields

Darryl Cousins darryl at darrylcousins.net.nz
Thu May 3 02:57:38 EDT 2007


Hi,

On Wed, 2007-05-02 at 15:07 +0200, Hermann Himmelbauer wrote:
> Hi,
> I'd like to know how to arrange (e.g. group) widgets in a form with formlib. 
> 
> One way would be to create a custom template file, where each widget is placed 
> via HTML. However, this is quite some work. 

I've often done this and it doesn't seem like too much work. But I don't
dispute your evaluation.

> 
> Another way would be to place the fields via CSS.
> 
> How do you deal with form layout?
> 
> Moreover I wonder if it's possible to customize the attributes "size" 
> and "maxlength" of HTML input fields via the zope schema. Schemas offer the 
> attribute "max_length", however this does not affect the rendered HTML - size 
> seems to be always set to "20", maxlength is never set.

My approach is different to Fred's because I rarely call setUpWidgets in
my form code. I have a bunch of custom widgets in a known place and use
custom_widget. Some widgets are for special fields or needs and some are
as simple as this one. I reuse it very often.:

class DescriptionWidget(TextAreaWidget):
    def __init__(self, context, request):
        super(TextAreaWidget, self).__init__(context, request)
        self.height = 3
        self.width = 85

Best regards,
Darryl Cousins

> 
> Is there any solution to this?

> 
> Best Regards,
> Hermann




> 



More information about the Zope3-users mailing list