logical operator in dtml-if
I am doing some error checking with <dtml-if>, simply to check that some variables exist, however I can't seem to find a syntax that ZOPE agrees with to use AND. what I want to do: <dtml-if Var AND anothervar AND yetanothervar> render page <dtml-else> you have to enter details in all the fields </dtml-if> I know this is a messy way to do it, and I'd appreciate all suggestions. Thanks, Matthew Parslow
Matthew Parslow wrote:
I am doing some error checking with <dtml-if>, simply to check that some variables exist, however I can't seem to find a syntax that ZOPE agrees with to use AND. what I want to do: <dtml-if Var AND anothervar AND yetanothervar> render page <dtml-else> you have to enter details in all the fields </dtml-if> I know this is a messy way to do it, and I'd appreciate all suggestions. Thanks, Matthew Parslow
Hmm... if you just want to check that everything is there, try (untested): <dtml-if "_.len(REQUEST.form) > X"> render page <dtml-else> go back and fix it </dtml-if> where x is the number of variables in your form. -- http://mindlace.net __________________ mindlace@imeme.net I don't want The Truth but I wouldn't mind a Big Analogy.
on Tuesday, March 28, 2000 Matthew Parslow wrote : MP> I am doing some error checking with <dtml-if>, simply to check that some MP> variables exist, however I can't seem to find a syntax that ZOPE agrees with to MP> use AND. MP> what I want to do: MP> <dtml-if Var AND anothervar AND yetanothervar> MP> render page MP> <dtml-else> MP> you have to enter details in all the fields MP> </dtml-if> MP> I know this is a messy way to do it, and I'd appreciate all suggestions. MP> Thanks, MP> Matthew Parslow a Python expression can take booleans, as far as i know.. try this: (untested) <dtml-if "spam AND eggs"> ^^^ ^^^ note the quotes -- Geir Bækholt Hansen web-developer/designer geirh@funcom.com http://www.funcom.com
participants (3)
-
Geir B Hansen -
Matthew Parslow -
mindlace