Start page
Start page

Start page / Template development / Rules / Validation <VALIDATION/>

<VALIDATION/> Validating input components

A validation is a certain handling instruction that is executed as long as conditions defined within the <WITH/> section are not fulfilled (i.e., as long as the value determination FALSE is returned). A validation is defined within a <DO/> section. This section must be defined within the tags that determine a restriction level and after that tags that initiate a handling instruction.

In the process, the following applies for the definition of a validation:

  • A validation can be optionally defined in a rule.
  • A validation must always be assigned to a certain input component with a form. Within the validation, an internal <PROPERTY/> tag is thus always defined with the name of an input component and the attribute VALID.
  • All the following handling instructions within the <VALIDATION/> section affect the input components defined there. If a <MESSAGE/> tag is therefore defined after the <PROPERTY/> tag, the corresponding message is displayed before this input component.
  • Within a <DO/> section, several <VALIDATION/> sections can be defined for various input components. The “validity” of the input component referenced within the <VALIDATION/>section always results from the Boolean value defined through the value determination. If different properties of a form or input component are linked with each other, all properties affect the “validity” of this component (and not only the properties that belong to this component) (see the “combined content check” example).

Example: combined content check

A form has three entry fields. The dynamic form should guarantee that at least one entry field has been filled by the editor during saving. For this purpose, each input component of the form is marked and given a note. As soon as the editor fills an input component, the markings and notes of all input components disappear and the form can be saved.

The value determination initially executes an emptiness check for each input component of the form (see the EMPTY property). These three conditions are linked with the logical <AND/> operator, which means that the condition of the rule is fulfilled only if all input components are empty (return TRUE). The negation is achieved by a surrounding <NOT/>.

The handling instructions within a validation are executed as long as the basic condition is not fulfilled; in this example, this is as long as all input components are empty. As soon as one input components of the form is filled, the value determination returns TRUE and the handling instruction within the validation are no longer executed.

<RULES>

<ON_SAVE>
<WITH>
<NOT>
<AND>
<PROPERTY source="st_headline" name="EMPTY"/>
<PROPERTY source="st_subheading" name="EMPTY"/>
<PROPERTY source="st_text" name="EMPTY"/>
</AND>
</NOT>
</WITH>
<DO>
<VALIDATION>
<PROPERTY source="st_headline" name="VALID"/>
<MESSAGE lang="*" text="A Headline, subheading or text must be provided!"/>
<MESSAGE lang="DE" text="Eine Überschrift, eine Zwischenüberschrift oder ein Text muss erfasst werden!"/>
</VALIDATION>
<VALIDATION>
<PROPERTY source="st_subheading" name="VALID"/>
<MESSAGE lang="*" text="A Headline, subheading or text must be provided!"/>
<MESSAGE lang="DE" text="Eine Überschrift, eine Zwischenüberschrift oder ein Text muss erfasst werden!"/>
</VALIDATION>
<VALIDATION>
<PROPERTY source="st_text" name="VALID"/>
<MESSAGE lang="*" text="A Headline, subheading or text must be provided!"/>
<MESSAGE lang="DE" text="Eine Überschrift, eine Zwischenüberschrift oder ein Text muss erfasst werden!"/>
</VALIDATION>
</DO>
</ON_SAVE>

</RULES>

© 2005 - 2014 e-Spirit AG | All rights reserved. | Last change: 2013-08-06