[Zope] Conditional Forms

hans hans@beehive.de
Mon, 11 Feb 2002 12:27:59 +0000


CLIFFORD ILKAY wrote:

> Hi,
>
> I have a page with a radio button group with three choices (Father, Mother,
> or Guardian) and a Submit button. I want to display a different form based
> upon the user choice. I have a folder called parentOrGuardianInfo. Within
> that folder are three folders, fathersInfo, mothersInfo, and guardiansInfo.
> Within those folders are the respective Formulator forms/folders. I am
> trying to do this:
>
> <dtml-if "_['relationship'] == 'father'">
> showFathersForm
> <dtml-elif "_['relationship'] == 'mother'">
> showMothersForm
> <dtml-else>
> showGuardiansForm
> </dtml-if>
>
> For showFathersForm, I tried doing:
>
> <dtml-var "fathersInfo.index_html">
>
> but that shows the dtml source rather than rendering the dtml source. How
> can I get it to render the dtml?
>
> Regards,
>

<dtml-var "fathersInfo.index_html"> is an expr="..." attribute
(that is, a valid python expression) and delivers the object,
which in your case is dtml-source.
to get the rendered dtml, you need to call it,
like
<dtml-var "fathersInfo.index_html()">
you might want to pass parameters also, in which case
http://www.zope.org/Members/michel/ZB/AppendixB.dtml says
__call__(client=None, REQUEST={}, **kw)