The item count validation rule checks that the number of items that are added to a field (that supports multiple items), meets a minimum, maximum or is between a range of expected values.
Use this validation method when you want to restrict how many images, assets or entries an author can select when creating an entry. Alternatively you can use this validation rule to determine how many fields can be added to a repeatable field.
Set the validation
With a content type open for editing:
- Select the field that has been set to allow multiple items e.g. Image, Asset or Component and pick the Validation tab from the Field Settings panel.
- Choose one of the following options from the Number of items dropdown:
Between allows you to set minimum and maximum values for an expected item count range.
e.g. Requires between 1 - 3 items
Minimum of allows you to set a minimum item count that needs to be met.
e.g. Requires a minimum of 2 items
Maximum of allows you to set the maximum number of items that can be added.
e.g. Requires a maximum of 200 characters
You can enter a custom validation message in the Validation Message text box. This will be displayed if the field fails validation when published.
Was this article helpful?