?
Solved

Concatinate addr fields in Javascript for Livecycle designer

Posted on 2014-09-20
9
Medium Priority
?
505 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
How many times a day do you open, acknowledge, or close an IT incident? What’s your process? Do you have a process depending on the incident, systems involved, and other factors? New Relic Alerts gives you options for how you interact with notifica…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

752 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