Configure Document Type Validators

Overview

This page explains how to configure additional validators for document types in Bloomreach Content. Validators enforce rules on content fields, compounds, or entire documents. You can use out-of-the-box validators or create custom ones if needed.

Most validators cannot be added through the document type editor. Instead, you must configure them manually using the Console. All validators work with both the Content application’s document editor and the Experience manager’s visual editor.

If the available validators do not meet your requirements, see Create a Custom Validator.

Available Validators

Out-of-the-Box Validators

The following table lists the standard validators included with Bloomreach Content. Default configurations are located at /hippo:configuration/hippo:modules/validation/hippo:moduleconfig.

NameDescription
escapedValidates that a string value does not contain the characters <, >, &, ", or '. Uses the regular expression:
/.*[<>&\"'].*/
Replace these characters with HTML entities such as &gt; or &lt;.
emailValidates that a value matches the email address pattern:
^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$
requiredValidates that a field value is present. The document type editor automatically adds this validator when you select the Required checkbox for a field. Internally, it uses other validators based on the field type. Required fields display an asterisk (*) after the label.
non-emptyValidates that a string field is not empty. Use this with optional fields. For mandatory fields, use the required validator instead.
non-empty-htmlValidates that an HTML field contains visible content. Empty tags such as p, span, or div are considered empty. Use for optional fields; otherwise, use the required validator.
referencesValidates that a Link field is not empty. Use with optional fields. For required fields, use the required validator.
image-referencesValidates that an Image Link field is not empty. Use with optional fields. For required fields, use the required validator.
urlValidates that a string is a valid URL by checking scheme, authority, path, query, and fragment. Available since version 14.5.

Additional Validators

Some validators are available as Java classes and require manual configuration in your implementation project at /hippo:configuration/hippo:modules/validation/hippo:moduleconfig. For details, see Create a Custom Validator.

Sequential Dates Validator

The Sequential Dates Validator checks that dates in two or more date fields are in sequence. This validator applies at the document or compound scope.

  • It reads all date properties from the node being validated. Nested properties are not supported.
  • Specify the date property names and their order using the multi-valued datePropertyNames property on the validator’s configuration node.
  • Missing or empty date properties are ignored. Use the required validator to enforce presence.

Example configuration from the Essentials library’s 'Events' feature:

/hippo:configuration/hippo:modules/validation/hippo:moduleconfig/myproject-events-sequential-dates: jcr:primaryType: hipposys:moduleconfig datePropertyNames: ['myproject:date', 'myproject:enddate'] hipposys:className: org.onehippo.cms.services.validation.validator.SequentialDatesValidator

Add Validators to Content Types

Add Validators to a Field in a Document Type

To assign validators to a specific field:

  1. Log in to the Console.
  2. Navigate to the relevant document type under /hippo:namespaces. For example: /hippo:namespaces/myproject/mydocumenttype.
  3. Go to the node type definition: /hippo:namespaces/myproject/mydocumenttype/hipposysedit:nodetype/hipposysedit:nodetype.
  4. Select the child node for the target field, such as /hippo:namespaces/myproject/mydocumenttype/hipposysedit:nodetype/hipposysedit:nodetype/email.
  5. Add the desired validator names (see Available Validators) to the multi-valued string property hipposysedit:validators. Ensure each validator supports the field or compound scope as required.

Example field configuration:

/hippo:namespaces/myproject/mydocumenttype/hipposysedit:nodetype/hipposysedit:nodetype/email: jcr:primaryType: hipposysedit:field hipposysedit:mandatory: false hipposysedit:multiple: false hipposysedit:ordered: false hipposysedit:path: myproject:email hipposysedit:primary: false hipposysedit:type: String hipposysedit:validators: [required, email]

Add Validators to a Document or Compound Type

To assign validators at the document or compound level:

  1. Log in to the Console.
  2. Navigate to the relevant document or compound type under /hippo:namespaces, for example: /hippo:namespaces/myproject/eventsdocument.
  3. Go to the node type definition: /hippo:namespaces/myproject/eventsdocument/hipposysedit:nodetype/hipposysedit:nodetype.
  4. Add the desired validator names (see Available Validators) to the multi-valued string property hipposysedit:validators. Ensure each validator supports the compound or document scope.

Example configuration from the Essentials library’s 'Events' feature:

/hippo:namespaces/myproject/eventsdocument/hipposysedit:nodetype/hipposysedit:nodetype: jcr:primaryType: hipposysedit:nodetype jcr:mixinTypes: ['hipposysedit:remodel', 'mix:referenceable'] hipposysedit:node: true hipposysedit:supertype: ['myproject:basedocument', 'hippostd:relaxed', 'hippotranslation:translated'] hipposysedit:uri: http://www.myproject.com/myproject/nt/1.0 hipposysedit:validators: [myproject-events-sequential-dates]
Share Feedback
Page: /build/document-types/document-types/document-type-field-validators
Section: Build
Category *