Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Hide all new instances from a button click

Avatar

Level 3

Here is my situation:

I have a checkbox that hides a text field and a table when the checkbox is not checked. Within the table, I have a button that when clicked adds another instance of the table. The checkbox, when unchecked, only hides the original table and does not hide the added instances.

What code do I use to hide all instances of the table?

Thanks,

Mallard27

1 Reply

Avatar

Level 10

Hi,

You just need to add additional code to loop through all of the instances and remove them until you get back to the minimum you have set.

Check out the script in the click event of this example: https://acrobat.com/#d=RZ1lzX23*u7L4N9rtWCYPQ

Here is the Javascript:

xfa.host.resetData();

while (flowedSubform.Table1._Row1.count > 2)

{

     flowedSubform.Table1._Row1.removeInstance(1);

}

Hope that helps,

Niall