Start page / Template development / Rules / Correction notes <MESSAGE/>

<MESSAGE/>: Displaying correction notes

The rule definition is used by the template developer to define correction notes that are displayed in the form directly below the affected input component.

These notes are defined in the rule using the <MESSAGE/> tag. The tag can only be used within the <VALIDATION/> section of a rule definition (see Subcategories of rule definition).

The following applies here:

  • The <VALIDATION/> section of a rule is carried out only if the basic value determination returns <FALSE/>. The note is only displayed to the editor when a rule violation occurs.
  • The note text always refers to a particular property of the form element. This means that a particular property of the form element is checked in the value determination area (e.g. “Is the input component empty?”) and this condition is then verified in the <VALIDATION/> section. It is necessary to add a <PROPERTY/> tag in both cases.

In addition to the ability to output a correction note using a <MESSAGE/> tag, it is also possible to use a CMS_LABEL type input component that is displayed or hidden as required.

Example

Rule displays a note when an input component is empty

In this example, a rule violation and a note are to be displayed in the form if an input component is empty.

For this purpose, the EMPTY property of the input component is checked within the <WITH/> section. If the input component is empty, the following expression returns the value TRUE:

<PROPERTY source="st_supplier" name="EMPTY"/>  
<!-- returns TRUE if the input component is empty -->

To ensure that the <VALIDATION/> section is carried out when the input component is empty, the expression must be negated:

<NOT>
<PROPERTY source="st_supplier" name="EMPTY"/>
</NOT>
<!-- returns FALSE if the input component is empty -->

The <VALIDATION/> section must then check the VALID property of the component:

<PROPERTY source="st_supplier" name="VALID"/>

If the input component is empty, the <VALIDATION/> section runs, a rule violation is displayed and the (language-dependent) note is displayed in the form area. Once the editor fixes the incorrect input in the form, the note (and rule violation) are hidden again.

<RULE>
<WITH>
<NOT>
<PROPERTY source="st_supplier" name="EMPTY"/>
</NOT>
</WITH>
<DO>
<VALIDATION scope="SAVE">
<PROPERTY source="st_supplier" name="VALID"/>
<MESSAGE lang="*" text="No supplier chosen!"/>
<MESSAGE lang="DE" text="Kein Lieferant ausgewählt!"/>
</VALIDATION>
</DO>
</RULE>

The note defined in the rule is also used to display the collected correction notes (see Figure).

© 2005 - 2022 Crownpeak Technology GmbH | All rights reserved. | FirstSpirit 2023.1 | Data privacy