Skip to main content
Browse Documentation
Limit a field to a specific number of items using item count

Limit a field to a specific number of items using item count

Created by Contensis product team, last modified by r.saunders on 11 Aug 2023

The 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

A feature component containing a title, description, image and link
An example of a feature component with a maximum item count set.

Set the validation

With a content type open for editing:

  1. 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.
  2. 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.