Question Details

avatar
You're on your way! It won't take you many more points to reach the next status level: Contributor. And as you answer other users questions and accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

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++)
{
form1.page1.Table.Row.instanceManager.removeInstance(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 694 days ago


2 Answers

Voted Best Answer

avatar
<p>Congratulations! The Acrobat User Community selection team has approved your status as Expert in the Acrobat User Community. We appreciate all your past contributions and hope you will continue to support the community by answering questions and participating in the Acrobat Answers Q&A program as you've done in the past.</p>

<p>As an expert, you will get a badge to display on your profile with the level EXPERT next to your name and you have become eligible to be nominated to the Adobe Community Professional Program.</p>

<p>After reviewing the Adobe Community Professional Program information at https://www.adobe.com/communities/professionals/, please let us know if you are interested.</p>

<p>Someone from the selection team will contact you soon regarding the community professional program. Keep up the good work!</p>

<p>Regards,</p>

<p>The Acrobat User Community Team</p>


<p>**** Disclosure Requirements for Endorsements Received by Third Parties  ****</p>

<p>If you endorse or refer people to the Acrobat User Community in any venue,  it is our responsibility to ensure that you are aware of required compliance with the <a href="http://ftc.gov/os/2009/10/091005revisedendorsementguides.pdf">FTC’s Guidelines</a>. Both you and Adobe can be held liable under federal law for making unsubstantiated claims and for not disclosing your relationship with Adobe. In particular:</p>

<ol>
<li>Always disclose if you have received any type of incentive – free products, promotional items, travel, gifts, payment, and so on from Adobe. The disclosure must be on the same page as the endorsement.</li>
<li>Be truthful. Endorsements should not be misleading. Never make unsubstantiated or exaggerated claims about the benefits of Adobe products or programs. Any statements or endorsements about an Adobe product must be based on upon your actual experience.</li>
</ol>

Thank you again for your support of Adobe and the Acrobat User Community</p>

Another solution is:

form1.page1.Table.Row.instanceManager.setInstance(0);

Thom Parker
The source for PDF Scripting Info pdfscripting.com
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 answered 650 days ago  |   Comments (1)  |  New Comment

avatar
Welcome to the Acrobat Answers site. You're on your way! It won't take you many more points to reach the next level: Participant. And as you accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

Thom, I am trying to do the same thing. Does the line you show above fit into the OP's code? Been trying to fit it in or use it on its own,but can't get it to work either way.
Thanks, Gary

GARYHATT Commented 321 days ago  |   Report


avatar

  |   Report
Was this answer helpful?  
1
0

avatar
You're on your way! It won't take you many more points to reach the next status level: Contributor. And as you answer other users questions and accumulate more points, you're also building your reputation with the community and with AcrobatUsers.com.

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)
{
_rowSubform.removeInstance(0);
}


Sergiy Kotenko answered 693 days ago  |   Comments (0)  |  New Comment

avatar

  |   Report
Was this answer helpful?  
0
0


Download
Acrobat XI trial

Get the trial now


Other Questions Needing Answers