Skip Navigation

[Resolved] limit number uploading files whit credform

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2621369

Tell us what you are trying to do?
Limit number uploading files whit repeating form.
But I can still upload more than 6 images.

Is there any documentation that you are following?

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

Is there a similar example that we can see?
<div class="row">
<div class="form-group col-md-12">
<label for="%%FORM_ID%%_overige-afbeeldingen0">[cred_i18n name='overige-afbeeldingen-label']<h5>Overige afbeeldingen (max. 6)</h5>[/cred_i18n]</label>
[cred_field field='overige-afbeeldingen' force_type='field' output='bootstrap' previewsize='thumbnail' isRepetitive='true']
</div>

What is the link to your site?
hidden link

#2621585

Hi,

Thank you for contacting us and I'd be happy to assist.

I've tested the script on my website and was able to make it work, with some changes:


jQuery(document).ready(function( $ ) {
	$('.js-wpt-repadd').click(function( e ) {
    	var length = $('input[type="file"]', $(this).closest('.js-wpt-field-items')).length;
    	if(length>=6) {
    		$(this).hide();
    		$('.wpt-repctl').last().hide();
    	}
    });
});

What it does is that it hides the 'Add new' link, when 6 instances of the upload field have been included.

regards,
Waqar

#2622607

My issue is resolved now. Thank you!