Script to delete all rows in dynamic table

Dear All,
can anyone help me with a script to delete all rows in LiveCycle pdf form dynamic table, please?

Here are some details: I have a dynamic table, which has Add Row and Delete Row buttons. My form also has a Reset Form button. However, if user creates Rows in the table by using Add Row button and then afterwards click a Reset Form, only data in table cells is cleared but all the created rows are still there.

I tried to solve the problem by following Javascript cycle:

var RowsNumber = form1.page1.Table.Row.instanceManager.count
for (i=1; i<=RowsNumber; i++)

this solve only 50% of the problem, because it only deletes every second row, leaving other half still there.

I assume there should be a very elegant solution, and I'm looking forward to hear your advise.

Thanks a lot!

Sergiy Kotenko

2 Answers

Voted Best Answer

Another solution is:


Thom Parker
The source for PDF Scripting Info
All About PDF Stamps in Acrobat and Paperless Workflows - THE BOOK !!

The Acrobat JavaScript Reference, Use it Early and Often

The most important JavaScript Development tool in Acrobat
The Console Window (Video tutorial)
The Console Window(article)

Having trouble, Why Doesn't my Script Work

By Thom Parker   

For anyone looking for a solution, I found a brilliant solution from Niall O'Donovan, and I'm really thankful for that.

Here is the script:

while (_rowSubform.count > 1)

Sergiy Kotenko   

Please specify a reason: