Skip to main content
Participant
Feb 5, 2025 1:19 PM UTC
Answered

Page spawned from template (multiple times)

I have a fomular created in Adobe (using Adobe Acrobat Pro 2020). In this form, a template has been added (called “Template10”). For this, there is a button on page 10 of the form. The button is supposed to work in such a way that when the user clicks on it, a page from the template (“Template10”) is to be added. When the user clicks it again, another page from “Template10” should be added. In addition, there is a script in the button that changes the labels of the newly added pages and renames the fields of these newly added pages (e.g., there is a field “Template.Cost” in the template, and the javascript changes it to “P1.Template1.Template.Cost”) - thanks to this solution, the fields on subsequent pages have their own names and do not duplicate the content entered by the user. And everything works great, but in Adobe Acrobat Pro 2020. When I open the file with Adobe Redaer, then: the page adds, the labels do not change, the field names do not change. Is there any chance to make such a solution work in Adobe Reader, or unfortunately, but I have to prepare separate templates for each newly added page, e.g. “Template10.1”, “Template10.2”, etc. and in each I have to change the field names right away?

I've added a sample page with working code on javascript and a template created.

try67
try67Correct answer
Community Expert
Feb 5, 2025 2:12 PM UTC

You should remove the try-catch clauses, and then you'll see that the call to the setPageLabels function is what's causing the error. You can't use that method in Reader, only in Acrobat. There is no way around that.

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Feb 5, 2025 2:12 PM UTC

You should remove the try-catch clauses, and then you'll see that the call to the setPageLabels function is what's causing the error. You can't use that method in Reader, only in Acrobat. There is no way around that.

Translate
Participant
Feb 6, 2025 10:20 AM UTC

Thanks. Now i get it. I remove it from my code in javascript and now it's work perfectly. Once again thanks.

Translate