Skip Navigation

[Resolved] Limit uploading number of repetitive images on a form

This support ticket is created 4 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 4 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#1400781

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)

#1401063

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.