Hi, I want to limit the number of repetitive images on a Toolset form.
I tried to implemet the solution I found here:
https://toolset.com/forums/topic/limit-number-uploading-files/#post-335393
I've added this code to my Form JS:
$('.js-wpt-repadd').click(function( e ) {
var length = $('input[type="file"]', $(this).closest('.js-wpt-field-items')).length;
if(length>=5) {
$(this).hide();
$('.wpt-repctl').last().hide();
}
SetDeleteEvent();
});
But I get this error:
Uncaught ReferenceError: SetDeleteEvent is not defined
at HTMLAnchorElement.<anonymous> (?typeid=33&form=editimages&listingid=3502:272)
at HTMLAnchorElement.dispatch (jquery.js?ver=1.12.4-wp:3)
at HTMLAnchorElement.r.handle (jquery.js?ver=1.12.4-wp:3)
Scroll back up on that page to see where the function SetDeleteEvent is defined: https://toolset.com/forums/topic/limit-number-uploading-files/#post-335096
There is no JavaScript API for Forms, so you're mostly on your own here. I can help with the PHP API for form validation in much more detail if you'd like to explore that.