Repeating item min and max

By: Alan Stockton | Asked: 09/18/2022
ForumsCategory: How-toRepeating item min and max
Alan Stockton asked 2 years ago

So i've been trying to create a form for my client, and we have this quantity field after which a repeating item shows up. Now, if the quantity is set at 2. I want the repeating item field to not go MORE than 2, but it still goes to 4 or 5 or as much as possible. Is there a way, I could get it restricted, because I see no option in the form settings at all.

Also, we had this table in gravity forms, where nested forms data is displayed in a table on the form. Is there a way to get a table to display the data submitted by the user in repeating item?
1 Answers
Rob LeVineRob LeVine answered 2 years ago
Alan Stockton replied 2 years ago

For the first link, its giving me only to limit the number of maximum number of times I can get a user to limit. I need to have both, a minimum and maximum. It somehow needs to be linked to my quantity field. Like lets say, the user selects quantity of 5. The repeater fields should not be less than 5 nor greater than 5. And I have like multiple amount of fields in the repeater section.

Rob LeVineRob LeVine replied 2 years ago

It's sounding like you're going to need to do this in jQuery. Once the quantity is set, you create the repeater rows, making the fields required so that they can't create any less. Make sure the add/remove buttons are hidden. You might be able to get some help from this link -

Alan Stockton replied 2 years ago

Okay, so lets remove this thing about min and max of the Repeater field. I have lets say a quantity of 20, and then the repeater fields which are about 17-19 fields. Per repeater = 1 quantity. Now, making the user click 20 times and making this form longer than it should be and increasing the load time on the site is quite harmful. It might even crash the User's browser. Is there no way, where the user can submit ONE repeater form, click add/remove/next and then submit another one. During this entire page change thing, there is a table sort of thing that shows the data he has entered till now.

Rob LeVineRob LeVine replied 2 years ago

It "appears" to me that you'd benefit from re-designing how the user inputs data, if you're concerned about how much stuff the user is entering (understandably). One idea, that may be way out there, is having the user upload a CSV file and then you go through it and create entries via PHP code. Though even as I type it, it seems like that would be a lot of code to validate fields, etc.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community