Field Validations

Marking a field as required
Validation Builder

You can add validations to a field to ensure the validity of data being entered into the CMS and through the APIs.


Marking a field as required

Fields can be marked as required to make sure that CMS entries and API endpoints throw an error in case this field is missing.

  1. Select a field you want to mark as required.
  2. Go to the VALIDATION tab in the properties panel for the field.
  3. Toggle the required field input to on.

Changes are saved automatically but still need to be published to reflect in the APIs and the Content management system.

Validation Builder

The validation builder allows users to build powerful and granular validation logic that needs to be applied to fields.

Validation Options

Property Description Possible Values
Property Validation will be applied on this field property. Value Value Length Date Time
Condition The condition which will be applied on the property. > >= = <= < Regex Email
Value The value against which the property will be compared. String

Depending on the input type different validation options are applicable. See Field Types for a list of the different validation operations.

Adding a validation

  1. To add a validation, click on + Add a validation Screenshot
  2. Select what property you want to apply the validation on.
    For example Value Length Screenshot
  3. Select the condition which will be applied on the property.
    For example Greater Than (>) Screenshot
  4. Enter the value against which the property will be compared.
    For example 20 Screenshot

Testing a validation

You can test a validation by entering an input into the test validation field next to the validation builder.


Editing a validation

You can edit the validation by clicking on the validation option that you want to edit and selecting the new value.

Changes save automatically, however they must be published before they are available in the CMS and the API

Deleting a validation

You can delete a validation by clicking on the delete icon next to a validation.

Did you find what you were looking for?
What went wrong?
Need more help?We have a thriving Discordcommunity that can help you with all things Canonic. →