Expand my Community achievements bar.

copy data from subform #2 to the third subform

Avatar

Level 2

HI All,

I tried to copy data from name subform and address subform to the combine subform (name and address subforms).It is only works for the name subform. However the address subform I cannot add a address subform after combine subform.  I spent alot time but it is not successfully. Please help.

here is my sample I try to make it works

https://files.acrobat.com/preview/c8172f31-5097-4c17-8a3a-3dbceac2363f

Thanks for your help,

Cindy

1 Reply

Avatar

Level 1

In the exit event of the legal_name field in the "name" subform, use the following script:

if (xfa.resolveNode("form1.page1.address[" +this.parent.index +"]").personName.rawValue != "") {

    xfa.resolveNode("form1.page1.combine[" +this.parent.index +"]").legal_name.rawValue = this.rawValue + " " + xfa.resolveNode("form1.page1.address[" +this.parent.index +"]").personName.rawValue;

} else {

    xfa.resolveNode("form1.page1.combine[" +this.parent.index +"]").legal_name.rawValue = this.rawValue;

}

In the exit event of the personName field in the "address" subform, use the following script:

if (xfa.resolveNode("form1.page1.name[" +this.parent.index +"]").legal_name.rawValue != "") {

    xfa.resolveNode("form1.page1.combine[" +this.parent.index +"]").legal_name.rawValue = xfa.resolveNode("form1.page1.name[" +this.parent.index +"]").legal_name.rawValue + " " + this.rawValue;

} else {

    xfa.resolveNode("form1.page1.combine[" +this.parent.index +"]").legal_name.rawValue += " " + this.rawValue;

}

You just need to build in the null check so that if one of the values is empty, "null" is not displayed in the combined form.