I'm new to Life Cycle Designer and need help with the following script:
txtComments.rawValue = Page1.Com1.rawValue + "\n" + Page1.Com2.rawValue + "\n" + Page1.Com3.rawValue;
What I'd really like to do is create an array/function that concatenates the fields titled Com* if there is data in these fields on page 1 of my form and display the data in the txtComments field on page 3 of my form. If there is no data, I do not want "null" to display for that field. The final form may have 60+ Com fields... It would be awful to have to hand code each of these. All this is triggered by a specific radio button selection.
I hope someone can help me. Let me know if you have questions. Thanks!
Solved! Go to Solution.
What if you put a for loop in and processed it that way ...something like this:
for (i=0;i<=number of com fields;i++){
if (xfa.resolveNode("Page1.Com" + i).rawValue != null){
txtComments.rawValue += xfa.resolveNode("Page1.Com" + i).rawValue + ", ";
}
}
This woudl loop through all of the com fields, check to see if they have a value and if so then add them to the txtComments field.
Paul
Views
Replies
Total Likes
What if you put a for loop in and processed it that way ...something like this:
for (i=0;i<=number of com fields;i++){
if (xfa.resolveNode("Page1.Com" + i).rawValue != null){
txtComments.rawValue += xfa.resolveNode("Page1.Com" + i).rawValue + ", ";
}
}
This woudl loop through all of the com fields, check to see if they have a value and if so then add them to the txtComments field.
Paul
Views
Replies
Total Likes
Thank you SO much, Paul...
Well, I feel like I'm much closer... I knew how to do a basic loop, but was having a devil of a time trying to figure out the commands for this JS. The only problem is that I'm not getting any data now. I tried using
Alerts(txtComments);
within the loop and outside of the loop in an effort to check the value of the txtComments field... but still see nothing. Idk what to do now.
Caroline
Views
Replies
Total Likes
Are you getting any errors in the javascript console?
At thi spoint seeing teh form would be helpful ...can you send it to LiveCycle8@gmail.com
Paul
Views
Replies
Total Likes
I'm at home now, but will send the form from work tomorrow. Thanks so very much!
Views
Replies
Total Likes
Paul,
I've sent 2 versionsn of my form to you. Any help you can provide is greatly appreciated!
Caroline
Views
Replies
Total Likes
I did not receive anything like this can you send it again and Identify this thread in the email? The email address is LiveCycle8@gmail.com
Paul
Views
Replies
Total Likes
Resent. Thanks!
Views
Replies
Total Likes
The email is from vwbugluvr@hotmail.com
Views
Replies
Total Likes
It works, Paul!!!! Thank you, thank you, thank you!!! I augmented the code slightly to include a break in between the fields. This is what I ended up with:
this.rawValue = " "
for (i=1;i<=72;i++) {
if (xfa.resolveNode("Page1.Com" + i).rawValue != null ){
this.rawValue += xfa.resolveNode("Page1.Com" + i).rawValue + "\n";
}
}
Now... the dilemna I have worked around for the time being is this... what if my Com fields flow over into pages 2 and 3? I suppose I could make additional txtComments fields, but that would look odd if nothing is populated on the 1st one and only a couple are say on the 2nd or 3rd page. Does that make sense? I lengthened my paper size in Word to get everything on one page as a work around, but I probably need to remedy this at some point considering I have a number of these forms to create. I played with the code a little bit to try and solve this on my own, but to no avail... yet. Thanks again!
Views
Replies
Total Likes
If you have Com fields across pages then you wil see that the expression access those objects will change ...hence you coudl use a for loop for each page. This assumes that you know how many com objcts are on each page. The you woudl adjust your for loop to start and end at the correct values.
If you do not know how many com objects there will be per page (i.e. this is a dynamic form) then there is a completely different approach we can take. Let me which way your form is set up.
Paul
I got it, Paul! I'm doing a jiggy dance over here! Thanks so very much!!!
Caroline
Views
Replies
Total Likes