Require x number of selections [RESOLVED]

I didn’t know how to search for this. It wasn’t even easy to come up with an appropriate subject!

We have a Gravity Form for registering for an event. The form allows for registering more than one entry. Often a family will register for three or four entries. Each entry is entitled to one shirt. There are six product fields, one for each of six sizes of shirts. Each field allows entering a quantity of shirts of that size.

But even though the instructions clearly state: “ONE SHIRT PER ENTRY” occasionally someone will order two shirts for one entry, or even no shirts. How can I ensure there is exactly one shirt ordered per entry?

Thanks!

Jim

Hi Jim. I put together a quick form of how this can work. Load this page in your browser:

Download the file and save that as anything.json (the filename does not matter, the json extension does.)

Then, go to your Forms dashboard and go to Forms → Import/Export → Import Forms, and upload this json file.

View the form, then preview it to see how it works. Whatever number you put in for Number of Players will be compared to the total number of t-shirts selected. If you enter more shirts than players, or less shirts than players, an HTML field will be shown conditionally with an explanation message, and the submit button is hidden.

If the number of t-shirts matches the number of players, the submit button will be shown.

Take a look at how the two calculation fields work (they can be switched to Hidden visibility on the Advanced tab once you see how it works) and how the conditional logic works, and let us know if you have any questions. Thank you.

p.s. I use this free snippet from Gravity Wiz to show a corresponding number of list rows when the number of players is entered (up to my maximum, which is six rows):

Excellent! Thanks for this elegant solution, Chris. I will incorporate those elements into the existing form and let you know how it goes.

Jim

1 Like

Works great, Chris, no issues. Thanks so much!

Jim

1 Like