Skip Navigation

[Resolved] Display limit number of in repeating field on view

This thread is resolved. Here is a description of the problem and solution.

Problem:
Limit the number of repeating field instance displayed on Toolset post edit form

Solution:
The thing is that there is no such feature available to control repeating field display with the post form.

The workaround to achieve this is you will require to add custom Javascript/jQuery code to your form's JS editor.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/display-limit-number-of-in-repeating-field-on-view/#post-1769011

Relevant Documentation:

This support ticket is created 4 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by hansooH 4 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1767989
form 2.jpg
form 1.jpg

Tell us what you are trying to do?

I'm making an attendance book now
The date of attendance uses a repeatable field.
And I want to create a form and enter the date I attended today
The problem is that if you use repeatable filed in the form, all the previously entered dates are displayed, but they are very long.
Is there a way to make this appear only on the last attendance date and the blank field entered today on the attendance date form?

The first image (form 1) is the current state
The second image (form 2)is the form I want.

Is there any documentation that you are following?
https://toolset.com/forums/topic/repeaters/

I think this article is about limiting the number of repeatable fields. My question is that even if there are a lot of dates in the repeatable field, what really shows is I only want to see the form showing the last input date and blank input field when entering a new date.
I have another report page with all the dates.

Is there a similar example that we can see?

What is the link to your site?

#1768213

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

The thing is that there is no such feature available to control repeating field display with the form as per your requirement.

The only way to achieve this is to write the custom JS code or maybe you can use the Toolset Forms's hook: cred_filter_field_before_add_to_form
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_filter_field_before_add_to_form

Please let me know if you will require further help on this. Please share problem URL where I can see the form where you added repeating field and access details.

*** Please make a FULL BACKUP of your database and website.***
I have set the next reply to private which means only you and I have access to it.

#1768767

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I try to access the page: hidden link

I see the message "No items found". Can you please confirm where I can see the form where I can see the repeating fields.

#1769011

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've added the following JS code to your form's JS Editor:
=> hidden link

jQuery(document).ready(function($){

  
$("div.js-wpt-field-items").each(function(){
  		$(this).find('div.wpt-repctl-flex:not(:last)').remove();
  });
  
});

I can see now only the last instance of repeating date field is displayed.

#1769021

My issue is resolved now. Thank you! Thank you! Thank you! Thank you! Thank you!