Limit a field to a specific number of items using item count
Log in to add to favouritesThe item count validation rule checks that the number of items that are added to a field supporting multiple items meets a minimum or maximum value, 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.
Appearance
Set the validation
With a content type open for editing:
- Select the field that has been set to allow multiple items, such as 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.
Minimum of allows you to set a minimum item count that needs to be met.
Maximum of allows you to set the maximum number of items that can be added.
You can enter a custom validation message in the Validation Message text box. This will be displayed if the field fails validation when published.