Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

populate table with array

Avatar

Level 1

Hi,

So I am relatively new to Javascript and have gotten my head around some of the basic language and functions used for creating Forms in LiveCycle Designer ES4.

I have 4 check boxes (say "check1", check 2...), and 4 predefined arrays ( "array1", array2....).

I have a table below all these with 3 columns, (col1, col2, col3).

What I want to do is this.

When I check "check1", I want to populate col2 of the table with array1.

Then add a new row for each piece of data in the array.

I want do the same for the other checkboxes as well, adding onto the table as required.

I've tried a heap of different options, but none seem to be able to work. At this stage I can't even get one array to populate the table, let alone multiple.

This is my current code: (the commented out section was just a try for joining the arrays)

    var array1 = new Array("one","two","Three","Four","Five");

    var array2 = new Array("this","that", "and this");

    var array3 = new Array("another one");

    var array4 = new Array("Finally this");

    var k = [];

   

    //if(check1.rawValue == "Yes")

   

    //{k = k.concat(array1)}

   

    //if(check2.rawValue == "Yes")

   

    //{k = k.concat(array2)}

   

    for

    (i=0; i<array1.length; i++){

    if (i>0) {Row01.InstanceManager.addInstance(1)}

    xfa.resolveNode("Table.Row01["+i+"].col2").rawValue = array1[i];

    }

Any help would be greatly appreciated. Thanks in advance.

0 Replies