Syntax
exists_expressions ::= 'exists:' expression
Description
Exists expressions test for the existence of paths. An exists expression returns true
when the path expressions following its expression returns a value and it is not undefined
. It is false
when the path expression cannot locate an object or if it evaluates to undefined
.
Note: some parts extracted from Zope Page Templates Reference.
Differences with ZPT
In ZPT if an expression evaluates to undefined
exists returns true
; ZPT-JS returns false
.
Examples
Testing for the existence of a property:
<div data-condition="not: exists: myObject/name"> Name not set! </div>
Note that in this case you can’t use the expression, not:myObject/name
, since that expression will be true
if the number variable exists and is zero.
Note: some parts extracted from Zope Page Templates Reference.