[Zope] Conditional Forms

CLIFFORD ILKAY zopeList@dinamis.com
Mon, 11 Feb 2002 07:09:40 -0500


Hi Hans,

Thanks so much for your quick reply. I tried using <dtml-var 
"fathersInfo.index_html()"> as you suggested. It gave me the following 
error message which makes no sense to me.

Error Type: NameError
Error Value: global name 'fathersForm' is not defined

If I enter the folder fathersInfo and click on the View tab, it renders the 
form without a problem. fathersForm is a Formulator form/folder contained 
within the folder called fathersInfo. Any suggestions?

Regards,

Clifford Ilkay
Dinamis Corporation
3266 Yonge Street, Suite 1419
Toronto, Ontario
Canada M4N 3P6

Tel: 416-410-3326

mailto:clifford_ilkay@dinamis.com

At 12:27 PM 2/11/02 +0000, hans wrote:
>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)