Define.pm
NAME
Communiware::DE::Define - Dynamic element Define
SYNOPSIS
<:Define attribute [value....] [type] [condition] :>
DESCRIPTION
Defines new context attribute in global context. It is not allowed to use parent context destinators in the first argument of Define.
Behavoir of Define if there already exists such attribute in the context is undefined, unless ifabsent or ifempty condition is specified (see below).
At least, if attribute is defined in current context, defined attribute wouldn't be visible.
Attempt to redefine already existing attribute may result in runtime error.
ARGUMENTS
- attribute
- Name of attribute to create/set
- value
- Value is value to be set. May be an arithmetic expression. See Communiware::Expr documentation for allowed operations and operands
- type
- type can be one of STRING NUMBER RICHTEXT or DATE. This attribute would be treated as such.
-
Type can be also specified as LIST/[STRING|NUMBER|RICHTEXT|DATE] This case it's value will be splitted by non-escaped comma and placed as list ito global context
-
If omitted, attribute would be considered STRING.
- condition
- Condition may be ifabsent, ifempty or append.
-
If this parameter is equal to ifabsent, this attribute will be defined only if it is not already present in context. So, it is useful to provide default values for design-specific cookies.
-
If this parameter is equal to ifempty then attribute would be defined if it is absent or present, but have empty value. This is useful for providing defaults for optional numeric input fields.
-
If attribute exists, but doesn't have type information associated with it (i.e. come from HTML form field), attribute value would be left unchanged, but tagged as specified type by both ifabsent and ifempty
-
If this parameter is equal to append, attribute will be treated as list and new value will be added to list of already present in global context values.