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.