Start page
Start page

Start page / Template development / Rules / Form properties <PROPERTY/> / Property SIZE

SIZE property

Checks the number of elements of an input component of type FS_LIST

The input component FS_LIST enables the creation of lists based on FirstSpirit data of different origins and types. The number of the list elements contained in an FS_LIST can usually be measured and evaluated using a rule. Using the SIZE attribute, for example, a rule can be defined which limits the number of possible entries in this input component to a certain value.

The expression <PROPERTY source='list' name='SIZE'/> can be used as the rule definition in the Value determination area (or for the definition of a precondition) and provides the number of entries that are currently contained in the input component.

In order to define a complete condition for a validation, a comparison value and an operator must be specified. Thus there are conditions such as these:

  • “Is the number of entries contained in the FS_LIST greater than 10?” or
  • “Is the number of entries contained in the FS_LIST less than 2?”

A comparison value such as these is required:

  • A constant, numeric comparison value (e.g. <NUMBER>10</NUMBER>) or
  • A variable comparison value, such as the number of entries in an additional FS_LIST

An operator is also required:

In this case, the expression will return a Boolean value.

Examples

Example 1) Limits the number of entries for an FS_LIST to a maximum of 2 entries

The following form contains an input component “st_list” (of type FS_LIST) for providing e-mail addresses. A dynamic form is to be used to ensure that the editor does not add more than two entries to the list.

To do so, the number of characters of the input component is retrieved and compared to a numeric constant in the <WITH/> section. The result of this “greater-than” check is a Boolean value, which this is then linked with a validation of the individual component in <DO/> section. As long as the condition (“number of entries is not greater than 2”) is not met, the <VALIDATION/> section of the rule is run and a correction notice is displayed. The form is prevented from being saved using the enclosing <ON_SAVE/> tags as well.

<ON_SAVE>
<WITH>
<NOT>
<GREATER_THAN>
<PROPERTY source="list" name="SIZE"/>
<NUMBER>2</NUMBER>
</GREATER_THAN>
</NOT>
</WITH>
<DO>
<VALIDATION>
<PROPERTY source="list" name="VALID"/>
<MESSAGE lang="*" text="Only 2 entries allowed!"/>
<MESSAGE lang="DE" text="Es sind nur 2 Einträge zugelassen!"/>
</VALIDATION>
</DO>
</ON_SAVE>

© 2005 - 2015 e-Spirit AG | All rights reserved. | Last change: 2013-12-09