Hi. I was wondering if there's a way to limit the number of instances in a repeating field. For instance, allow only 5 images uploads in a repeating field.
I tried with this solution https://toolset.com/forums/topic/minimum-maximum-number-of-adding-images-in-cred-of-specific-repeating-field/ but I can't achieve it to work.
Hello,
There isn't such a built-in feature within Tooslet form plugin.
In the thread you mentioned above:
https://toolset.com/forums/topic/minimum-maximum-number-of-adding-images-in-cred-of-specific-repeating-field/#post-901992
Those custom codes does not work for the user too, so if you agree we can take it as a feature request, our developers will evaluate it.
If you are going to try custom codes, please provide a test site with the same problem, also point out the problem page URL and form URL, I need to test and debug it in a live website
Thanks for the details, I can login your website, I assume we are talking about the Toolset post form "Nuevo Anuncio Gratis":
hidden link
In section "Content", click "JS Editor", the custom JS codes can not be saved correctly in your website, for example, you can input one single quote ' in it, and save the form, check it again, it is saved as \', this problem is abnormal, it might be a compatibility problem, I suggest you try to locate the problem plugin/theme.
As a workaround, you can move the custom JS codes into the wordpress page, I have tried these in your website:
1) Edit the form "Nuevo Anuncio Gratis", remove custom JS codes,
2) Move them into the page "Colocar Anuncio Gratis" content:
hidden link
<script type='text/javascript' class='custom-js'>jQuery(document).ready(function($){
$('.js-wpt-repadd').click(function( e ) {
var length = $('input[type="file"]', $(this).closest('.js-wpt-field-items')).length;
if(length>=5) {
$(this).hide();
}
});
});</script>
You can test it in the front-end:
hidden link
In the field "mágenes Adicionales", click link "Add new" 5 times, you should be able to see it is hiden when there is more than 5 instances.
Hi Luo Yang,
Didn't know it was possible to add code directly on the page. It is working good. I replicated the same code in another page and it worked smoothly.
Thanks for you support.
Juan