Solved

Concatinate addr fields in Javascript for Livecycle designer

Posted on 2014-09-20
9
488 Views
1 Endorsement
Last Modified: 2014-09-20
Hi , I am trying to concatenate addr fields for the text field in the live cycle designer using java script  as below

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

Open in new window


but i am only getting the CAO name and addr1 on my forms even though i have values for addr2, city, state , zip

can somebody help me to understand if the formula in have in the script layout is correct.


Thanks
de1209
1
Comment
Question by:Koushik Anna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 58

Expert Comment

by:Gary
ID: 40334561
Where you are using || you should be using +
0
 

Author Comment

by:Koushik Anna
ID: 40334567
Thank you Gary , i tried as below , but doesnt seem to work , any advice

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 +"\n" + xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue }
                    else
                    {xfa.resolveNode("#subform[1].City").rawValue + xfa.resolveNode("#subform[1].State").rawValue + xfa.resolveNode("#subform[1].Replyzip").rawValue
                    }
0
 
LVL 58

Expert Comment

by:Gary
ID: 40334576
Any error?
Are you sure this is returning a null value and not just a blank or undefined value?
xfa.resolveNode("#subform[1].Addr2").rawValue)!= null

If you alert the values do you get the values?
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 82

Expert Comment

by:leakim971
ID: 40334580
Try this :
this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";
this.rawValue += ( xfa.resolveNode("#subform[1].Addr2").rawValue  || "") + ( xfa.resolveNode("#subform[1].City").rawValue || xfa.resolveNode("#subform[1].State").rawValue || xfa.resolveNode("#subform[1].Replyzip").rawValue );

Open in new window

0
 

Author Comment

by:Koushik Anna
ID: 40334598
I tried you script, if the addr2 field is null its is returning as

Name
Addr1
null
State, city zip.
trying to avoid the null if there is no addr2.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 40334612
Strange...
Try this one :
this.rawValue = xfa.resolveNode("#subform[1].CAOName").rawValue + "\n" + xfa.resolveNode("#subform[1].Addr1").rawValue + "\n";
this.rawValue += (xfa.resolveNode("#subform[1].Addr2").rawValue  == null) ?"": xfa.resolveNode("#subform[1].Addr2").rawValue;
this.rawValue +=   xfa.resolveNode("#subform[1].City").rawValue || xfa.resolveNode("#subform[1].State").rawValue || xfa.resolveNode("#subform[1].Replyzip").rawValue;

Open in new window

0
 

Author Comment

by:Koushik Anna
ID: 40334619
Thank you Gary, it worked.  but one last question
what does " += " indicate..?
0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40334625
Gary? I'm leakim971...

this.rawValue = this.rawValue +
same as :
this.rawValue +=
0
 

Author Comment

by:Koushik Anna
ID: 40334629
Thank you very much leakim971, and i am extremely sorry for the name mess up ,  i apologize.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question