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).

Regards
-Tom


class SearchForm(LayoutMixin, form.EditForm):
    interface.implements(ISearch)

    form_fields=form.Fields(ISearch)
    form_fields['results'].custom_widget = HTMLDisplayWidget

    form_method='GET'

    form_layout=VertLayout(
        ).addText(u"Training Guide",
        ).addWidget('search_type', label=u"Select one of the following
items",
        ).addText(u"<hr />"
        ).add(GridLayout(
            ).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,
            )
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to