[Zope] Testing for Equality

CLIFFORD ILKAY zopeList@dinamis.com
Thu, 14 Feb 2002 15:09:47 -0500


Hi Hans,

That has to be the problem. In thinking about my approach to solve the 
problem of saving the state of form variables over multiple forms, I think 
it is flawed. Consider this.

Form1 -> Form2 -> Form3 -> Save data collected over the previous 3 forms in 
DBMS.

Form3 will not have access to Form1's variables unless I go through the 
ugly exercise of having a bunch of hidden fields, just like SAME_RESIDENCE 
in my original example. That seems like an awful lot of work to go through. 
Can you suggest any alternative approaches?

Regards,

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

Tel: 416-410-3326

mailto:clifford_ilkay@dinamis.com

Only 24 days to AmerOmnis 2002.
Register at <http://www.AmerOmnis.com>.

At 11:16 AM 2/14/02 +0000, hans wrote:
>CLIFFORD ILKAY wrote:
>
> > Hi,
> >
> > I have a form which the user is supposed to indicate whether their
> > residence is the same as their spouse's residence. If the mother and father
> > live in the same residence, I want to skip the mother's address because we
> > already have it. If the residence is not the same, I want the user to enter
> > the mother's address. Here is how I implemented it.
> >
> > I have a form called maritalStatus on which the user selects from a radio
> > button group their marital status and also selects Yes or No to the
> > question about the residence address. The post method for that form is a
> > folder name, forms, in which index_html is a form which is used to enter
> > the father's info. This form receives a variable called SAME_RESIDENCE from
> > the maritalStatus form. I need to pass SAME_RESIDENCE on from the father's
> > form to the mother's form so I have a hidden field in the form which looks
> > like this:
> >
> > <input type=hidden name=SAME_RESIDENCE.<dtml-var
> > expr="_.getitem('SAME_RESIDENCE')">:record>
> >
> > The post method for the father's form is a folder called mothers which is
> > contained within forms. Its index_html is the mother's info form.
> > SAME_RESIDENCE is passed to it by the father's form in REQUEST.form. I am
> > having difficulty with testing for the value of SAME_RESIDENCE. Here is the
> > code I am using.
> >
> > <dtml-if expr="_.getitem('SAME_RESIDENCE')=='Y'">
> > Same residence
> > <dtml-else>
> > Not the same residence
> > </dtml-if>
> >
> > The expression always evaluates false so I guess I am doing something
> > wrong. For debugging purposes, I added the following to the top of the 
> page:
> >
> > <p>Same Residence = <dtml-var expr="_.getitem('SAME_RESIDENCE')"></p>
> >
> > and the value of SAME_RESIDENCE changes appropriately as I select Yes or No
> > on the maritalStatus form so I know that it is not the problem. Any idea
> > what I am doing wrong?
>
>could it be that SR is a record?
>for brevity, let x=_.getitem('SAME_RESIDENCE')
>then
><input type=hidden name=SAME_RESIDENCE.<dtml-var
>expr="x">:record>
>delivers a record SR
>with a component SR.x which is text.
>so you are comparing a record with a string (always false)
>read also
>http://www.zope.org/Members/Zen/howto/FormVariableTypes