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
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
My issue is resolved now. Thank you!