Creating rules: the structure of a rule
Each rule consists of the follow subcategories:
Within a rule definition (<RULES>...</RULES>), several independent rules can be defined for a form, whereby each rule is initiated by a restriction level and must contain at least one value determination and one handling instruction.
1. Determining the restriction level
Each rule is based on a restriction level that controls the editorial process in case of invalid states and, for example, inhibits the saving of an incorrect entry. The selection of the restriction level also influences the display of the rule violation in JavaClient or WebClient.
Possible tags:
- <ON_SAVE/>
- <ON_EVENT/>
- <ON_RELEASE/>
For additional information, see Controlling editorial processes (restriction levels).
2. Defining an (optional) precondition
In a rule definition, a precondition can be defined within an <IF/> section. A precondition always refers to a certain property of the form element (e.g., “is the input component focused?”) or even the form (“was the form opened in the Content Store?”). The subsequent sections of the rule definition are performed only if the precondition is fulfilled (and this section returns the TRUE rule definition).
For further information, see Defining a precondition for the execution of the rule.
3. Value determination
A rule always checks one or more properties of the form (“In which editorial language is the form edited?”) or an individual form element (“Is the value of the component NULL?”). The desired properties are taken into consideration in the value determination of the rule definition.
The value determination can take place:
- synchronously within a <WITH/> tag or
- asynchronously within a <SCHEDULE/> tag
The determined result is then evaluated within the handling instruction.
For further information, see Defining a value determination or Defining asynchronous rule execution.
4. Defining a handling instruction
For each rule, a handling instruction must be defined that functions depending on the previously defined conditions (within the value determination). In the handling instruction, the template developer links the results from the value determination with certain actions in the form, such as the selection of an input component or the display of a correction note. Handling instructions are defined within a <DO/> section.
For further information, see Defining a handling instruction.
5. (Optional) validation
A validation is a certain handling instruction that is performed as long as the conditions defined within the <WITH/> section are not fulfilled (i.e., as long as the value determination returns FALSE). A validation is defined within a <VALIDATION/> section in the <DO/> area of a rule and must always be assigned to a certain input component within the form. An internal <PROPERTY/> tag is thus defined within the validation with the name of an input component and the attribute VALID.
For further information, see Validating input components.