Hi Jens I have tried the method you have suggested but I think the first time the page is loaded one value for the variable "id" is being expected . So I am getting an error like this: The XML page cannot be displayed Cannot view XML input using XSL style sheet. Please correct the error and then click the button, or try again later. ---------------------------------------------------------------------------- -- A name contained an invalid character. Error processing resource 'http://192.168.10.11:8080/oms/Users/pl'. Line 3, Position 56 exceptions.KeyError on id in "<PythonExpr request.form['id'] == 't' or nothing>" -------------------------------------------------------^ Could you tell me how I can rewrite this so that the first time the page is loaded even if there is no value for "id" the page will be shown . And only if I pass a form variable it should execute. Thanks and Best Regards John Kunchandy ----- Original Message ----- From: "Jens Vagelpohl" To: "zope" Cc: Sent: Tuesday, August 20, 2002 5:26 PM Subject: Re: [Zope] Tal:condition problem
i would *not* put both the tal:condition and metal:use-macro statements on a single tag. separate them so each is on its own tag::
<div tal:condition="python:request.form['id'] == 't' or nothing"> <metal:block use-macro="container/zptmac_memtask/macros/zptmac_taskslist"
List </metal:block> </div>
jens
On Tuesday, August 20, 2002, at 07:18 , zope wrote:
Hi All I am trying to execute a macro only if a condition is satisified. The code I am using is:
<div tal:condition="python:request.form['id'] == 't' | nothing" metal:use-macro="container/zptmac_memtask/macros/zptmac_taskslist"> List </div> <div tal:condition="python:request.form['id'] == 'p' | nothing" metal:use-macro="container/zptmac_mempending/macros/zptmac_pendlist"> List </div> <div tal:condition="python:request.form['id'] == 'w' | nothing" metal:use-macro="container/zptmac_memweek/macros/zptmac_weeklist"> List </div> <div tal:condition="python:request.form['id'] == 'a' | nothing" metal:use-macro="container/zptmac_memall/macros/zptmac_alllist"> List </div> Depending on which value is passed with the form object i want that a particular macro be called. But as soon as this page is rendered it shows me all the macros irrespective of whether I am sending any value for "id". Is there some way I can check the condition and only show the required macro. I m sure someone working on this particular area dealing with different conditions can help me out.
Best Regards John Kunchandy
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.381 / Virus Database: 214 - Release Date: 8/2/2002