Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How do you delete "added" pages in flowed form

Avatar

Level 1

I have a two page form. On page two, there is a button that allows the user to add a new page (instance), which we can call page 2.2. They can do that as many times as they want (ex. if they click on the add new page button three times, you would now have a five page form, page 1, page 2.1, page 2.2 page 2.3, and page 2.4.)

I also have a clear form button on page one, that allows them to clear the form. I would like the clear form button to remove all "added" pages, so when cleared, the form has the original page one and page two, and no additional pages.

Thanks for any help you can offer.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you look at the reset button in this from, you will see a loop to go through and remove the instances and reset the form.

https://acrobat.com/#d=KVeR0qUe9TMd0CCRBEeFTA

A similar approach would work for repeating pages.

Good luck,

Niall

View solution in original post

2 Replies

Avatar

Correct answer by
Level 10

Hi,

If you look at the reset button in this from, you will see a loop to go through and remove the instances and reset the form.

https://acrobat.com/#d=KVeR0qUe9TMd0CCRBEeFTA

A similar approach would work for repeating pages.

Good luck,

Niall

Avatar

Level 1

Thanks for the lead on the correct script.

I used what you had, but tweaked it to look at the total number of pages (which is where you were directing me).

The script is below. Since I know I only want to have two pages in the form, this cycles through and deletes those pages we don't need.

while (xfa.host.numPages > 2)

{

    _page2.removeInstance(1);

}

I actually prefer people going back to a clean form, but my customer wanted the end users to be able to just start over with the current form.

This form has four barcodes, two on each page, that are populated on print. Plus field validations all over the place. When complete, I will post the various scripts so others can use as a resource.

Thanks again. This problem is solved.