These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

prepopulation data in the table

cindy_77
Registered: Sep 10 2008
Posts: 16

Hi,I have the problem about coding when I use the array to display the data in the table. I don't know what I am missing in the code, the data is only displayed in the first row, and second row is displayed empty. I have spent a lot of time to figure the solution however I am not successful.I need your help. Thank you.
var part1 = new Array("A", "3", 78,9)
var part2 = new Array("E", "2", 45,8);
var b = new Array(new Array("A","3",78,9), new Array("E","2",45,8) )
var a = new Array()
a[0]=form1.page1.Table1.Row1.TextField1
a[1]=form1.page1.Table1.Row1.TextField2
a[2]=form1.page1.Table1.Row1.TextField3
a[3]=form1.page1.Table1.Row1.TextField4
a[4]=form1.page1.Table1.Row2.TextField5
a[5]=form1.page1.Table1.Row2.TextField6
a[6]=form1.page1.Table1.Row2.TextField7
a[7]=form1.page1.Table1.Row2.TextField8
for (var i=0; i

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Your code has been cut off because of the "Less Than" symbol, use "<" instead.

However, from the code that I can see, the "a" array is acquiring the field objects from the first "Row2" only. If there are other repeated "Row2"s. I don't see how they are being populated. Please post the rest of the code.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

cindy_77
Registered: Sep 10 2008
Posts: 16
I don't know why the complete coding is not display, here is the rest

for (var i=0; i
cindy_77
Registered: Sep 10 2008
Posts: 16
Please let me know how to post the coding. It is not displayed the rest the of coding. I don't know why?
cindy_77
Registered: Sep 10 2008
Posts: 16
Here is the completed coding:

var part1 = new Array("A","3",78,9)
var part2 = new Array("E","2",45,8);
var part3 = new Array("C","1","14",9);
var b = new Array("",part1,part2,part3)
var a = new Array()
a[0]=form1.page1.Table1.Row1.TextField1;
a[1]=form1.page1.Table1.Row1.TextField2;
a[2]=form1.page1.Table1.Row1.TextField3;
a[3]=form1.page1.Table1.Row1.TextField4;
a[4]=form1.page1.Table1.Row2.TextField5;
a[5]=form1.page1.Table1.Row2.TextField6;
a[6]=form1.page1.Table1.Row2.TextField7;
a[7]=form1.page1.Table1.Row2.TextField8;
a[8]=form1.page1.Table1.Row3.TextField9;
a[9]=form1.page1.Table1.Row3.TextField10;
a[10]=form1.page1.Table1.Row3.TextField11;
a[11]=form1.page1.Table1.Row3.TextField12;

for (var i=0; i &lt a.length; i++){
for (var j=0; j &lt b.length; j++){
a[i].rawValue=b[j][i] ;
}
}
Thanks,
Cindy
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Have you looked in the console window to see if there are any reported errors? I would imagine that an exception is thrown when i=4.

The "a" array is one dimensional and has 12 entries, so in the first loop "i" will vary between 0 and 11. The "b" array is two dimensional and has 3x4 entries. So, "i" cannot be used directly as an index for "b" since it is out of range for both of the "b" dimensions.

The easiest solution is to give both arrays the same structure so that the indices are in sync.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script