Validating multiple fields of the same entity

Last updated on
21 August 2023

There are three types of validations:
1. Requiring at least one of several fields available on a page
2. Repetition of values on multiple fields
3. Unique values on multiple fields

They work on several fields of the same bundle. The configuration is a little strange, we need add the same validator to each field instance, and make sure the "group name" in the validation rule is the same one.

For example, we have three fields:
field1, field2, field3,

we want to add "Require at least one of several fields" on those fields.

Then we need add this validator to field1, on the validation rule config page, enter group name, such as "group_name_1".
Then we need add this validator to field2, on the validation rule config page, enter group name, such as "group_name_1".
Then we need add this validator to field3, on the validation rule config page, enter group name, such as "group_name_1".

It is a little strange,and the error message may appear three times. However, it works. It is the best way to support multiple fields.

Maybe we could improve those 3 validators in the future.

Help improve this page

Page status: Not set

You can: