[Zope3-Users] formlib widget

Jeff Shell eucci.group at gmail.com
Fri Dec 1 18:56:29 EST 2006


On 11/29/06, Dennis Schulz <d.schulz81 at gmx.net> wrote:
> Hi,
>
> in a formlib based form I would like to have more control over the
> rendering of the widgets.
> is it possible to call widget with a specific name directly instead of
> running through all on a repeat loop?
> for example
>
>   <div tal:define="name string:1;
>                   w1 view/widgets.get(name)" >
>
> I saw that there is a get method but I can't access it form the page
> template.

It certainly is possible. As another reply pointed out, you're mixing
Path and Python expressions above, which won't work.

A common technique I use is to define a local reference to widgets
(often to something short like 'w'), and then access the widgets
within that setup::

    <form ... tal:define="w view/widgets">


      <!-- call (render) the firstname widget -->
      <input tal:replace="structure w/firstname" />

    </form>


Anyways, you can use the 'python' or 'nocall' expressions if you want
to get the widget unrendered:

    <div tal:define="w1 python:view.widgets['1']">
      or
    <div tal:define="w1 python:view.widgets.get('1')">
      or
    <div tal:define="w1 nocall:view/widgets/1">


-- 
Jeff Shell


More information about the Zope3-users mailing list