always fill out the very last row of a table (which can expand)

Avatar

Avatar

SunsV

Avatar

SunsV

SunsV

12-07-2014

Hi, I'm having problems with a button in table A that adds a row to another table (table B) and then automatically fills out some of the table row data (table A) into the newly created row of the other table (table B)

Here's my code (on click of button in a row of Table A) - I should also mention that Table A has a button to add more rows to itself:

This almost works - however, it only works if the amount of rows in each table match - which they don't necessarily as the user may or may not opt to add the row from table A to table B. eg. Table A could be 4 rows deep, but table B may only contain 2 Rows.

tableB.row.addInstance(0);

var vCol1 = this.resolveNodes("tableA.row.cellA");

var vCol2 = this.resolveNodes("tableB.row.cellA");

var vCol3 = this.resolveNodes("tableA.row.cellB");

var vCol4 = this.resolveNodes("tableB.row.cellB");

for (var i = 0; i < vCol1.length; i ++) {

             vCol2.item(i).rawValue = vCol1.item(i).rawValue;

             vCol4.item(i).rawValue = vCol3.item(i).rawValue;

}

I'm new to scripting (learning on the fly) so my question is, seeing that the first command is to add a new row to table B, can I alter the code so that var vCol2 and vCol4 always relate to the very latest row that has been created? In that way, any previous rows that have been added will shunt down the list and will not be affected but the new button click? Or is there a better way of doing this.

View Entire Topic

Avatar

Avatar

SunsV

Avatar

SunsV

SunsV

13-07-2014

Hi Bruce and everyone else.

Here's a link to my file. It has come from a very large form, so I've cut it down to help. It's simply called test1.pdf.

I've also done some screenshots to illustrate the problem - as you'll see it looks as if it is working, but then starts to fail by overriding existing rows.

livecycle env.jpg

screen1.jpg

screen2.jpg

screen3.jpg

screen4.jpg

screen5.jpg

I really would appreciate some help with this as I can't figure it out myself.

Sunil