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

Tom Dossis td at yoma.com.au
Thu May 3 18:42:46 EDT 2007

Hermann Himmelbauer wrote:
>>> 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.
> Well, when looking at the template, I roughly have to write this for every 
> widget:
> <div class="label">
>     <label for="field.name" title="The widget's hint"
>         tal:attributes="for view/widgets/foo; title view/widgets/foo/hint"
>         tal:content="view/widgets/foo/label">Label</label>
> </div>
> <div tal:condition="view/widgets/foo/error"
>     tal:content="structure view/widgets/foo/error">Error</div>
> <div class="field">
>     <input tal:replace="structure view/widgets/foo" />
> </div>

Hi Hermann,

I started a form layout add-on for formlib, see snippet below..

It's a very rudimentary first cut, and only provides a grid (table)
layout.  I can't see myself getting any time to work on it in the
immediate future.  If you think it might be useful I can send you the
package (which includes doctests).


class SearchForm(LayoutMixin, form.EditForm):

    form_fields['results'].custom_widget = HTMLDisplayWidget


        ).addText(u"Training Guide",
        ).addWidget('search_type', label=u"Select one of the following
        ).addText(u"<hr />"
            ).addText(u"Search Criteria", 0, 0, colspan=5,
            ).addWidget('region', 1, 0,
            ).addWidget('institution', 1, 2,
            ).addWidget('skill', 2, 0,
            ).addWidget('text', 2, 2,
            ).addAction('search', 2, 4,
            ).addWidget('results', 3, 0, colspan=5, label=None,

More information about the Zope3-users mailing list