[Zope3-Users] Arranging widgets in a form / Limit size of input
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
>>> 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
> <div class="label">
> <label for="field.name" title="The widget's hint"
> tal:attributes="for view/widgets/foo; title view/widgets/foo/hint"
> <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" />
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
).addWidget('search_type', label=u"Select one of the following
).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