Copy link to clipboard
Copied
Hello,
I've been surfing the web for this one for a while.
I'm using Adobe acrobat standard 2017 and I'm creating a form in which I have multiple different sections.
I wish to add a button which would trigger the duplication of a section (with its fields). This button would be named "Add new objective". Note : the action button would be different then "create a new page".
I'm guessing its a Javascript command. Anybody have any experience regarding this type of command?
Thanks!
Copy link to clipboard
Copied
PDF forms don't really work that way. You can create fields in advance and then hide/show them as needed, but you can't "re-flow" the entire page (or document), unless it is all composed out of fields, and even then it will take a lot of scripting to achieve it.
Copy link to clipboard
Copied
With JavaScript, you can either add a new page and that new page can contain fields, or you can unhide fields (that were previously hidden) on existing pages. For the latter, this can include buttons that either contain page contents (as their icon) or obscure underlying page content, as a way to display/hide page content, similar to how layers can be used. Note that using Standard makes it more difficult to work with JavaScript since some features are removed (e.g., Document JavaScripts), so some of what you find out there may not work for you.
What doesn't work in Acrobat is adding new sections and having page content reflow. This type of thing is possible with dynamic XFA forms, but you can't create them with any version of Acrobat.
Copy link to clipboard
Copied
Alright, thanks to both of you. I guess the form on which I'm basing this one had used the Hidden/display command. The problem is this previous form has a security protection so I can't seen how the script is used.
I think the best way would be to hide a whole page where I would put the section to be "added" trough the button. This button would trigger the display of the hidden page and its content. I just have to figure out how !
Thank you for your help
Copy link to clipboard
Copied
Here's an article on hiding and showing form fields.
https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm
For whole pages, you cannot exactly hide and show pages. You can "spawn" and delete Template pages. Search for Page Template on this forum and you'll find lots of code.