At 03:45 PM 2/10/99 -0600, you wrote:
I would prefer not to have to replicate the full document within each portion of the if-elif-elif-else block, but I can't find a way to set a variable in the if-elif-elif-else block that can carry over to the rest of the document, since Zope considers it an error for a tag to be only partially contained within a larger block.
Please help.
I'm going to piggy back on this question, as I was just about to ask something very similar--I think. Being new to Zope, and coming from the programming school that smaller and faster is better, I attempted to create a page that had a couple of interactive forms, and then a display form built into it. Various sections of the page would become visible depending on which "submit" buttons were pressed when. I actually had all the display stuff working quite nicely, it was just the calculation stuff that was causing me problems. It appeared that when a page was itself the subject of ACTION in a form, a number of variables that were initially set when the first submit button was pressed vanished (became unset) when the second submit button was pressed. This caused me no end of grief. I tried storing some of the required form variables under new names using REQUEST.set(), but this seemed to have no effect. Eventually, I abandoned my approach of trying to cram everything into one page, so I took the first form and made it a page to itelf, the second form got its own page, and the display form also got its own page. I actually liked this as the HTML and the DTML were far easier to follow and it appeared to work nice and fast. Well, I got all the display stuff working correctly across the three documents and then attempted to put in the calculations that were required. I was terribly disappointed to discover that variables that were assigned in Form One, and were displayed in Form Two no longer existed when I got to the form that displayed the results. Here is some highly edited DTML, with my comments added in C++ syntax index_html: <FORM ACTION="detail_html" METHOD="POST"> <table border=1> <th align="center"><B>Desired Margin</B></th> <tr> <td> <input type="radio" name="margin" value="1.12">12%<BR> <input type="radio" name="margin" value="1.17" checked>17%<BR> <input type="radio" name="margin" value="1.27">27%<BR> </td> </tr> </table> <input type="submit" name="MarginBtn" value="Select Margin" align="CENTER"> </FORM> detail_html: <p><b>Margin:</b> <!--#var margin--></p> //This works exactly as it should. It displays the //margin that was selected in index_html <FORM ACTION="form_html" METHOD="POST"> <table border=1> <!--#in PriceCategories--> <tr> <td> <B><!--#var Category--></B> </td> <td> <select name="<!--#var Category-->" size=1> //This is all much nicer thanks to an earlier <!--#in "PriceTable(PriceGroup=Category)"--> //response from Amos Thanks! <option><!--#var Description--> //The fact that it works at all is a testament to <!--#/in--> //Zope's utility, thanks DC. </select> </td> </tr> <!--#/in--> </table> <input type="submit" name="Calculate" value="Calculate" align="CENTER"> </FORM> form_html: <p><b>Margin:</b> <!--#var margin--></p> //This breaks. Why is "margin" undefined when I get here? //Tracebacks show a NameError The rest of the doc deleted as it breaks on the first line. Any help or enlightenment would be tremendously appreciated. -- Stand Fast, tjg. =================================== Timothy J. Grant tjg@avalongroup.net Avalon Technology Group www.avalongroup.net (503) 246-3630 voice (503) 246-3124 fax This message may be digitally signed with PGP. A PGP signature guarantees that this message really did come from me. For more information regarding digital signatures and encryption, please contact me.