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