Solved

Concatinate addr fields in Javascript for Livecycle designer

Posted on 2014-09-20
9
454 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
ScreenConnect 6.0 Free Trial

At ScreenConnect, partner feedback doesn't fall on deaf ears. We collected partner suggestions off of their virtual wish list and transformed them into one game-changing release: ScreenConnect 6.0. Explore all of the extras and enhancements for yourself!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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)
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…

773 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