Site Manager Developer Manual / Version 2307
Table Of Contents<DocumentType name="article"> <PropertyType name="Author"> <Validator class="NotEmpty2"/> </PropertyType> </DocumentType>
Example 5.9. Example for the use of a validator
When a document is checked in, validators test whether certain conditions are fulfilled. At the present time, four validators are delivered with the Site Manager. These check, whether a field
is filled,
is filled with a certain pattern,
contains an integer in a specified range
A link list field can be checked for a minimal, maximal number of entries and for unique entries. In addition, the allocation of a linklist field can be checked.
Another class can be used to combine several validators and one always validates to "true".
In addition, own validator classes can be written. These classes implement the interface
hox.corem.editor.validation.Validator2
and must be specified via the element <Validator>
.
Validator | Description |
---|---|
SetValidator2 |
Using this class several validators can be combined as subelements Validator of the element Validator. SetValidator2 uses the Validator2 interface and replaces the deprecated SetValidator class. Example:
|
NotEmpty2 | This validator checks whether entries have been made in a field. If the field
is empty, an error message is created and the document is not accepted for checking
in. The validator must be named as the value in the Attribute class of
the element <Validator> . NotEmpty2 uses the Validator2 interface and replaces the deprecated NotEmpty class. |
GenericValidator | This validator checks whether a field is filled with the appropriate pattern.
If the entry is wrong, an error message is created and the document is not accepted
for checking in. The validator is called implicitly, if the attribute
validPattern of the element <PropertyType> is
used. As a valid Pattern, any regular expression can be used (see the element
<PropertyType> in Section 5.2.3, “Configuring Document Types”).
|
MinMaxIntegerValidator |
This validator checks whether a field is filled with an integer in the appropriate range. If the entry
is wrong, an error message is created and the document is not accepted for checking in. This validator
must be set with the class attribute within the element
Example: |
LinkListValidator |
This validator checks whether a linklist field is filled with a minimum (attribute
Example:
Thus, at least one entry must be contained in the linklist field and the documents belonging to the
entries must be located below the folder |
AlwaysTrueValidator | This validator always validates to "true". If you use multiple editor XML configuration files (see Chapter 3, Operation and Configuration), you can use the validator to override other validators. |
Table 5.26. Validator classes