Skip Navigation

[Resolved] limit number uploading files

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 5 replies, has 2 voices.

Last updated by mcjS 6 years ago.

Assigned support staff: Minesh.

Author
Posts
#335096

I am trying to: limit the number of files to upload with CRED.

I visited this URL: https://toolset.com/forums/topic/limit-mumbr-of-instances-of-multiple-repeating-fields/

I expected to see: that is also works on a edit cred form, not only on a create cred form.

Instead, I got: It works when i create a new custom post type. The maximum 5 works fine. Not able to upload 6.
But when I want to change my custom post type, I can add more files then the existing 5.

This is the coding I'm using:

jQuery(function( $ ) {
$('.js-wpt-repadd').blur(function( e ) {
var length = $('input[type="file"]', $(this).closest('.js-wpt-field-items')).length;
if(length>=5) {
$(this).hide();
}
SetDeleteEvent();
});

var SetDeleteEvent = function() {
$('.js-wpt-repdelete').each(function(index, element) {
if (!$(element).data('bound')) {
$(element).click(function(e) {
var length = $('input[type="file"]', $(this).parent()).length;
if(length<=5) {
$('.js-wpt-repadd', $(this).closest('.js-wpt-field-items')).show();
}
}).data('bound', true);
}
});
};
SetDeleteEvent();

});

#335108

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

*** Please make a FULL BACKUP of your database and website.***

1)
After reviewing your debug information, I found that you are running with old Toolset plugins. Could you please try to resolve your issue by updating all Toolset plugins to its latest official release version. You can download it from:
=> https://toolset.com/account/downloads/

2)
Could you please check your browser's console for any possible Javascript error. If yes, could you please share the error details here as well as few screenshots will be helpful.

#335117

I'm sorry, I'm not going to upgrade. Why? The site has to go live very soon and I have a custom fix in this view version i'm using.
Can you still help?

#335121

Minesh
Supporter

Languages: English (English )

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

I'll definitely help you.

We always encourage our users to use latest Toolset plugins as fixes are features are available in the form of updates. if you are ready to update your Toolset plugins:
*** Please make a FULL BACKUP of your database and website.***

Also, after reviewing your debug information I can see that you are using old version of WordPress as well. Do you really think you want to go with same WordPress version?

However, Could you please share a link where I can reproduce your issue?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#335393

Minesh
Supporter

Languages: English (English )

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

Could you please check your issue now.

I've modified your JS code within your CRED edit form.

Could you please check your issue now at.
=> hidden link

I've added following JS code to your CRED form:

$('.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();
    });
#335706

Thanks!