Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

Unable to save data when clicking on Add button

Avatar

Level 2

Hi,

I have repeating field with an default value, so I used add Instance but when I click on "+" button another instance is getting added but the value is also getting repeating. My requirement is whenever an new instance added it should be empty so that user can entry it easily. I have tried the below script.

But the problem is when ever I click add all fields that are added dynamically is getting reset. Can anyone help me please.

Page1.Chapter1.Subform.STP.instanceManager.addInstance(1);

var addCount = Page1.Chapter1.Subform._STP.count; //.instanceManager.instanceIndex;

    for(i=0;i<addCount ;i++)

    {

        if(addCount >=2)

        {

        xfa.resolveNode("handleManualLettersReq.Page1.Chapter1.Subform.STP["+(i+1)+"].Cell3").rawValue = "";

        }

       

    }

1 Accepted Solution

Avatar

Correct answer by
Level 4

I tried to implement the logic as per your reqirement using following script:


var rowNodes = Table1.Row1.instanceManager.count;

for (var nNodeCount = 1; nNodeCount < rowNodes ; nNodeCount ++)

{

 

    xfa.resolveNode("form1.page1.Table1.Row1["+nNodeCount+"].TextField1").rawValue = "";

}

Sample form is avilable here:

Dropbox - AddRemove.pdf

Similar example is given at following link: Adobe PDF Forms

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

I tried to implement the logic as per your reqirement using following script:


var rowNodes = Table1.Row1.instanceManager.count;

for (var nNodeCount = 1; nNodeCount < rowNodes ; nNodeCount ++)

{

 

    xfa.resolveNode("form1.page1.Table1.Row1["+nNodeCount+"].TextField1").rawValue = "";

}

Sample form is avilable here:

Dropbox - AddRemove.pdf

Similar example is given at following link: Adobe PDF Forms