Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

trying to concatenate the address fields as below using javascript

Avatar

Level 2

trying to concatenate the address fields as below using javascript

this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue || "\n"

  if((xfa.resolveNode("#subform[1].Addr2").rawValue)!= null)
  {
  xfa.resolveNode("#subform[1].Addr2").rawValue}
  else
  {xfa.resolveNode("#subform[1].City").rawValue||xfa.resolveNode("#subform[1].State").rawValue||xfa.resolveNode("#subform[1].Replyzip").rawValue

but only the name and addr1 are printing, can somebody help me on correcting my script..Thanks

DE1209

1 Accepted Solution

Avatar

Correct answer by
Level 7

Try something like this:


this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";


if ((xfa.resolveNode("#subform[1].Addr2").rawValue) != null) {


    this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].Addr2").rawValue;


} else {


    this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue


}


View solution in original post

2 Replies

Avatar

Correct answer by
Level 7

Try something like this:


this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";


if ((xfa.resolveNode("#subform[1].Addr2").rawValue) != null) {


    this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].Addr2").rawValue;


} else {


    this.rawValue = this.rawValue + xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue


}