Skip Navigation

[Resolved] Limit repeatable fields for user input

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 3 years, 10 months ago.

Assisted by: Jamal.

Author
Posts
#2117033
Screen Shot 2021-07-15 at 12.09.38 PM.png

Tell us what you are trying to do?

I have a post field group that contains a repeating image field and repeating single line (caption) field that will be displayed in a Toolset View. I’d like to limit the number of times these fields can be repeated to ensure that the user only inputs one set of these fields.

Is there any documentation that you are following?
https://toolset.com/forums/topic/limit-repeating-fields/

Thanks,
Leslie

#2117329

Hello and thank you for contacting Toolset support.

Currently, there is no way to limit the number of items a user can add into a repeatable field group. However, if you are going to let the user add the data using a Toolset form, there will be a solution using custom code. Some PHP code for form validation and some Javascript code will deactivate the "add item" button on the form. Check this similar ticket https://toolset.com/forums/topic/require-limit-number-of-repeating-field-group-entries/

However, if you are going to let users add the data from the backend, I am afraid there is no way of doing it. Expect, perhaps, using a separate custom post type for screenshots and captions, and a One-to-many relationship that you can actually limit the number of related items.

I hope this answers your question. Let me know if you have any further questions.

Side note: I don't think you will need to have two repeatable field groups to hold the screenshots and captions. Use only one field group that has two fields, an image field for the screenshot and a single line field for the caption.

#2120305

Hi Jamal,

Thanks for the information and note about repeatable field groups. Is there a way to limit the amount of characters for a single line field?

Thanks,
Leslie

New threads created by Jamal and linked to this one are listed below:

https://toolset.com/forums/topic/split-limit-characters-in-single-line-field/

#2123091

Hello Leslie, I am glad I could help.

However, for support rules, we are able to handle only one issue at a time. This helps us to bring you a better service and also helps other users to find all the information here exposed. For that reason, I have created a new ticket and I'll be replying there.

If you don't need further assistance with the original request of this ticket, please mark it as resolved.