Welcome to the nuBuilder Forums!

Join our community by registering and logging in.
As a member, you'll get access to exclusive forums, resources, and content available only to registered users.

Cloned subform is empty

Questions related to using nuBuilder Forte.
Post Reply
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Cloned subform is empty

Unread post by shuray »

Hi.
I have a form with 2 subforms. One of them is cloneable, the second is not.

When I press the Clone button, the first form remains filled up with records (and it is perfect), but the second becomes totally empty, even without starting empty row, so I cannot fill this subform by new records.

I need tht starting row in the second subform.
How to display it?
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Cloned subform is empty

Unread post by kev1n »

Hi,

Could you try this updated nuEmptyNoClone() function ? Replace the one in nuform.js.

Code: Select all

function nuEmptyNoClone() {

    const noclone = nuSERVERRESPONSE.noclone;

    if (!noclone || !Array.isArray(noclone)) return;

    noclone.forEach(function(item) {
        if (item.subform) {
            $('#' + item.id + 'scrollDiv .nuSubform1, #' + item.id + 'scrollDiv .nuSubform0').each(function() {
                if (this.id !== item.id + '000nuRECORD') {
                    $(this).remove();
                }
            });

            $('#' + item.id + '000nuRECORD').children().each(function() {
                if ($(this).hasClass('nuEdited')) {
                    $(this).val('');
                    if ($('#' + this.id + 'button').length) {
                        $('#' + this.id + 'code, #' + this.id + 'description').val('');
                    }
                }
            });

            $('#' + item.id + '000nuDelete').prop('checked', true);
            $('#' + item.id + '001nuRECORD').remove();
        } else {
            $('#' + item.id).val('').trigger("change");
        }
    });

}
shuray
Posts: 30
Joined: Sun Apr 23, 2023 3:36 pm
Has thanked: 10 times
Been thanked: 5 times

Re: Cloned subform is empty

Unread post by shuray »

kev1n wrote: Sat Mar 30, 2024 8:04 am Hi,

Could you try this updated nuEmptyNoClone() function ? Replace the one in nuform.js.
...
It is working.
Thank you, Kev1n!
databs1234
Posts: 30
Joined: Wed Sep 06, 2023 12:45 am

Re: Cloned subform is empty

Unread post by databs1234 »

I'm not certain if my issue is the same, when cloning a subform the subform looks fine but after saving the object list is empty on the new cloned subform. Is this a fix for this issue? Thanks.
kev1n
nuBuilder Team
Posts: 4562
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 76 times
Been thanked: 528 times
Contact:

Re: Cloned subform is empty

Unread post by kev1n »

I just tried to clone an access level and I don't experience that problem.
Please provide more details.
databs1234
Posts: 30
Joined: Wed Sep 06, 2023 12:45 am

Re: Cloned subform is empty

Unread post by databs1234 »

the issue is when cloning a form based upon a view, when I cloned the same form based upon a table it worked, but when cloning a form based upon a view, the object list is empty. I can create the form manually and input the objects using fast form, there is a word around, just could not figure out why the object list was empty. Thanks.
Post Reply