This topic contains 4 reply and 2 voices, and was last updated by Nayem 4 years, 8 months ago
Viewing 4 Posts - 1 through 4 (of 4 total)
Author Posts
February 21, 2015 at 9:58 pm 37299
Nayem Hi, I am trying to make the repeater field only show 5 options, and not allow the user to add 100 (if they wanted too). I have tried replacing this
for (var i=0; i<5; ++i ){
              $('.wpuf-form').on('click', 'img.wpuf-clone-field', this.cloneField);
            }
in frontend-form.js but this just adds 5 everytime the user click the + button. Please help? Rupert
February 21, 2015 at 9:59 pm 37300
Rupert Rupert

so this is the whole section of script:

init: function() {
            // clone and remove repeated field
            for (var i=0; i<5; ++i ){
              $('.wpuf-form').on('click', 'img.wpuf-clone-field', this.cloneField);
            }
           
            $('.wpuf-form').on('click', 'img.wpuf-remove-field', this.removeField);
            $('.wpuf-form').on('click', 'a.wpuf-delete-avatar', this.deleteAvatar);
            $('.wpuf-form').on('click', 'a#wpuf-post-draft', this.draftPost);

            $('.wpuf-form-add').on('submit', this.formSubmit);
            $('form#post').on('submit', this.adminPostSubmit);

            this.ajaxCategory();
            // image insert
            // this.insertImage();
        },
February 23, 2015 at 4:38 pm 37431
Nayem Nayem

Hello Rupert,

Pelase open Wp user frotned/assets/js/frotned-form.js and find this function which named as “cloneField”. Please replace the function content with this one-

cloneField: function( e ) {
            e.preventDefault();

            var $div = $(this).closest('tr');
            var $clone = $div.clone();
            var count = $div.closest('tbody').find('tr').length;
            if(count > 4){
                return false;
            }

            //clear the inputs
            $clone.find('input').val('');
            $clone.find(':checked').attr('checked', '');
            $div.after($clone);
},

Thank you 🙂

February 24, 2015 at 2:33 am 37473
Rupert Rupert

Hello Nayem,

Fantastic. Perfect!!!!

Thank you so much.

Rupert

February 24, 2015 at 10:55 am 37493
Nayem Nayem

Hello Rupert,

You are welcome. I am marking this topic as resolved.

Thank you 🙂

Viewing 4 Posts - 1 through 4 (of 4 total)