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

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.

Tagged: 

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 3 months, 3 weeks ago.

Assigned support staff: 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

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

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.

The topic ‘[Closed] Limit uploading number of repetitive images on a form’ is closed to new replies.