Limiting quantities

Limiting quantities

In Cognito Forms, you can set quantity limits and track quantities for many field types. Quantity limits are useful for product orders, ticket sales, signups, reservations, surveys, and any other scenario for which there’s a limit to the number of times a specific value may be selected or entered across all submitted entries for a form.

Quantities are tracked for each unique value entered for the field, such as each email address, or each choice field selection. Quantity limits are updated and enforced when selections are made, and then again before forms are submitted. If the limit is exceeded, an error message is displayed. Quantities are only counted for submitted entries, not incomplete or deleted entries.

Setting limits

Supported field types for quantity limits include:

  • Textbox - Single Line
  • Choice - Dropdown or Radio Buttons
  • Yes/No
  • Date/Time
  • Email, Phone, or Website
  • Calculation - Text, Yes/No, Date, and Time

To set a quantity limit, select a supported field type and specify the Limit Quantity option in the field settings.

Limiting quantity options.

  • No Duplicates – Limit the quantity allowed to just one. Once your limit is set, you can write a custom error message to display when the limit is exceeded.
  • Specific Quantity – Specify a quantity limit greater than one. This value can be either a constant integer, or an integer calculation.
  • Never – Quantity limits are not enforced. This option is set by default.

Choice fields

For Choice fields, you can first select Limit Quantities from the Choice options in the field settings. Then, specify a quantity for each choice option. Leaving a quantity blank will ensure that quantity limits are not enforced for that choice option. After you set your choice quantities, you can enter a custom error message to display when the limit is exceeded.

Choice field quantity options.

Just like with Assign Prices and Assign Values, when Limit Quantities is selected for a Choice field, the quantity of the selected choice is available within calculations as FieldName_Quantity. Also, if the assigned quantity is used to calculate the quantity limit for another field, quantity limits will not be validated for the Choice field itself, which is useful for more complex quantity limit scenarios.

Yes/No fields

For Yes/No fields, quantity limits only apply to Yes responses. This is useful for registration forms or other scenarios where form submitters can opt into an event (like a dinner) where a limited number of spots are available. Unlimited No responses are allowed.

Calculation fields

While Calculation fields support quantity limits just like other fields, they have special capabilities that make it possible to implement complex quantity limit scenarios. When you enforce quantity limits on a hidden calculation field (when Show This Field is Internally or Never), the quantity limit error message will automatically appear under the fields referenced by the calculation for the field. This makes it possible to enforce multi-field combination limits, like rooms on a specific date, or ticket types for a specific performance, and show quantity limit errors on the fields that must be changed to correct the problem.


In addition to automatically limiting quantities and showing errors, you can also access the quantity limit, the quantity remaining and the quantity used for the selected/entered field value within calculations. These calculation properties are named as follows:

  • FieldName_QuantityLimit: The quantity limit for the current field value.
  • FieldName_QuantityUsed: The amount of times the current field value has been specified, including all submitted entries and changes reflected in the current entry.
  • FieldName_QuantityRemaining: The difference between the quantity limit and the quantity used. This value will be negative when the limit has been exceeded for a given field value.

For submitted entries, these quantity limit calculation properties reflect the values they had when the entry was submitted, and will only update when the entry is edited. This allows you to see what the quantity limit was at the time of submission in situations when the limit is later changed to something else. Please keep this in mind when viewing submitted entries and calculations that rely on these quantity limit calculation properties.


Common uses of quantity limits include:

1) Unique Email Address

Limit people to just one submission per unique email address:

  1. Add an Email field to capture the email address of the form submitter
  2. Set Limit Quantity to No Duplicates
  3. Write an error message (ex: “Only one submission per email address is allowed.”)

Limiting to one unique email address.

2) Unique IP Address

Limit the number of submissions per unique IP address:

  1. Add a Calculation field to look up the IP address of form submitters
  2. Set Calculation to =Entry.Origin.IpAddress
  3. Set Show This Field to Internally
  4. Set Limit Duplicates to Specific Quantity
  5. Set Quantity to the number of submissions allowed per IP address, such as 2
  6. Write an error message (ex: “Only two submissions are allowed per person.”)

Limiting to unique ip address.

3) Limited Use Discount Codes

Limit the number of times a discount code can be used:

  1. Add a Text field to capture a limited use discount code
  2. Set Limit Duplicates to Specific Quantity
  3. Set Quantity to =if DiscountCode = "SUNDRIED" then 20 else if DiscountCode = "SCOTFREE" then 10 else null
  4. Set ErrorMessage to This discount code has expired!
  5. Set Show Custom Error to When
  6. Show the custom error when DiscountCode is filled out and DiscountCode_QuantityLimit is not filled out
  7. Set ErrorMessage to Invalid discount code!

If you have lots of discount codes or need to constantly add and remove discount codes over time, the following additional steps will help makes things easier to maintain:

  1. Add a Choice field to track available discount codes
  2. Add Choices for each available discount code
  3. Select Limit Quantities to specify a quantity for each discount code
  4. Select Assign Prices or Assign Values to enter prices/percentage discounts for each choice value
  5. Set DefaultValue to =DiscountCode
  6. Set Show This Field to Never to hide this list of available discount codes
  7. For the discount code Text field, set Quantity to =AvailableDiscountCodes_Quantity
  8. Set ErrorMessage to Discount code quantity exceeded
  9. Add a Price field to calculate the discount based on the assigned prices. Set the amount to =if DiscountCode = AvailableDiscountCode then -AvailableDiscountCode_Price else 0

Limited use discount codes.

4) Signup Limits

Limit the number of attendees to an event:

  1. Add a Yes/No field for users to sign up
  2. Set Limit Duplicates to Specific Quantity
  3. Set Quantity to a specific number of attendees
  4. Write an error message (ex: “The pre-event dinner has reached capacity!”)

Sign up limits.

5) Product Inventory

Limit the number of times a specific product may be selected based on available quantity:

  1. Add a Choice field containing a list of products
  2. Select Limit Quantities and specify a quantity for each product
  3. Write an error message (ex: “Out of Stock.”)

Limiting product inventory.

6) Ticket Sales

Add a Choice field to select a performance to attend (Friday night, Saturday matinee, Saturday night):

  1. Add a Choice field to select the ticket class (premium, standard, basic)
  2. Select Limit Quantities to allow quantities to be specified for each seat type
  3. Specify a Quantity for each seat type
  4. Add a Calculation field to limit available tickets for each performance
  5. Set Calculation to =Performance + "-" + SeatType
  6. Set Show This Field to Internally
  7. Set Limit Duplicates to Specific Quantity
  8. Set Quantity to =SeatType_Quantity
  9. Write an error message (ex: “Sorry, there are no more seats available for the selected ticket class.”)

Ticket sales

7) Timeslot Limits

Limit the number of attendees to a class on each unique date the class is offered:

  1. Add a Choice field containing a list of classes
  2. Add a Date field for users to select a date to attend class
  3. Add a Custom Error to the Date field limiting date selections to days that the selected class is available, such as Tuesdays and Thursdays
  4. Add a Calculation field and use the following expression:
  5. Set Calculation to =Class + Date
  6. Set Show This Field to Internally
  7. Set Limit Duplicates to Specific Quantity
  8. Set Quantity to a specific number of attendees, like 20
  9. Write an error message (ex: “Class is full on this date.”)


8) Limit Form Submissions

Limit the total number of submitted form entries:

Add a Calculation field to the bottom of your form Set Calculation to Registration Set Quantity Limits to Specific Quantity Set Quantity to 20 Set Error Message to Registration is full! Set Show This Field to Never

Limiting form submissions.