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

Hermann Himmelbauer dusty at qwer.tk
Thu May 3 11:18:41 EDT 2007


Am Donnerstag, 3. Mai 2007 08:57 schrieb Darryl Cousins:
> 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.

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>

In my case, I have several forms with e.g. 10-15 fields, so this adds up and 
in the end the templates are quite complex. If there were some shortcut or 
macro which generates the above HTML-code, it would be a lot easier, perhaps 
there's a decent solution? If it would looke something like this, it would be 
much easier to manage:

<span tal:content="view/widgets/foo/gen_html />

Best Regards,
Hermann

-- 
x1 at aon.at
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7


More information about the Zope3-users mailing list