cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in getting current row index of a dynamic table

Former Member
0 Kudos

Hi All,

Expected Result:

I have a dynamic table which has 'FromDate' and 'ToDate' Columns. The validation I have to do is , a period given in a row must not overlap with other periods in the same table. For example, in one row if its FromDate: 10-10-2008 ToDate:15-10-2008 ( Dates are in DD-MM-YYYY format) and other row must not have a 'FromDate' or 'ToDate' within 10-10-2008 and 15-10-2008.

Actual Result:

I have written the javascript to (1)check this and (2)delete the wrong date values. The first part(1) is working correctly, but the second (2) part is not working. Instead of deleting the wrong dates(in current row) entered, someother row's 'FromDate' and 'ToDate' are deleted.

Cause for the Problem:

In the script, I am getting the currently entered 'FromDate' and 'ToDate' using this.parent.index, and I run a 'for' loop to iterate through all the rows in the dynamic table and check the above condition. If found invalid, I have written code to delete the current row(this.parent.index) 'FromDate' and 'ToDate'. But, the code 'this.parent.index' is not returning the current rows index, insted its returning some other row's index(randomly).If I give the date values in row 7, the current row is displayed(in message box) as 1 or 2 or someother, and it displays all the row index one by one. The cause is, the loop I am running to iterate through the rows of the table.

for(var i=0;i<Noofrows;i++)
{
    <some code>
     FromDate = xfa.resolveNode("Subform1.Table1.Row1["+i+"].FromDate[0]").rawValue;
    <some code>
}

If I remove the line inside the loop, this.parent.index returns the correct(current) row index.

I can't understand, why it is behaving like this....

Thanks,

Prabhakar.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

it is a bug in the Acrobat Reader. I had the same problem. Just add an input field called "myIndex" into the row and store there the current index when creating the line. With this solution you can programatically work with your own created index without the bug of the Acrobat Reader.

Take care,

Thomas