[Product-Developers] Rendering plone.z3cform widgets in a page template

Carsten Senger senger at rehfisch.de
Fri Feb 13 01:20:20 UTC 2009


Hi Tim,

Tim Knapp schrieb:
> Hi,
> 
> I would like to use plone.z3cform in a viewlet but I'd also like to add
> some descriptive text beside the widget as well as some other
> miscellaneous TAL/HTML. In order to render the widgets in the
> plone.z3cform how do I get access to them, are they available from the
> 'view' object somehow or by some other means? I'm also assuming to
> render the widget (once I've got it), I just call the widget.render()
> method?

<tal:r replace="structure python:view.widgets['message'].render()" />

You need to use your own layout cause the standard form wrapper wraps 
the form into the main_template.
This should work (untested):

from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile

layout = ViewPageTemplateFile('mylayout.pt')

wrap_form(my_unwrapped_form, index=layout)

..Carsten




More information about the Product-Developers mailing list