[Zope] Conditional Forms

Phil Harris phil@harris-family.info
Mon, 11 Feb 2002 12:20:36 -0000


When calling DTML Methods in this way you have what might be described as a
shortage of namespace.

The namespace of the current request is not passed through to the caled
method, so you need to pass it through:

<dtml-var  "fathersInfo.index_html(_.None,_)">

this should do what you want.

hth

Phil
----- Original Message -----
From: "CLIFFORD ILKAY" <zopeList@dinamis.com>
To: <zope@zope.org>
Cc: "CLIFFORD ILKAY" <clifford_ilkay@dinamis.com>
Sent: Monday, February 11, 2002 12:09 PM
Subject: Re: [Zope] Conditional Forms


> 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)
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )