Solved

Concatinate addr fields in Javascript for Livecycle designer

Posted on 2014-09-20
9
441 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
  • 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
 
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
Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

 

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to hide html tags in text area 4 37
SharePoint 2013 Blog Template 2 37
Debugging step-by-step Jquery/Javascript 6 59
JavaScript: Issue with onClick 5 36
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
I'd like to talk about something that is near and dear to my heart: build systems. Without them, building software is all about compiling locally, with software versions everywhere. It can be a mess. Today we are going to discuss building a small di…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
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)

863 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now