ZPT-JS reference - Exists expressions

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 in an object:

<div data-condition="not: exists: myObject/name">
    Name not set!
</div>
                

Note: some parts extracted from Zope Page Templates Reference.