Skip navigation
Currently Being Moderated

Help creating an array

Oct 26, 2011 9:42 AM

Tags: #problem #javascript #livecycle #adobe_livecycle #adobe_livecycle_form

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!

 
Replies
  • Currently Being Moderated
    Oct 26, 2011 9:54 AM   in reply to Miss Caroline

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 26, 2011 11:52 AM   in reply to Miss Caroline

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 31, 2011 7:34 AM   in reply to Miss Caroline

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 1, 2011 6:48 AM   in reply to Miss Caroline

    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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points