Copy link to clipboard
Copied
Hello!
I am working on a multi-page form for my company that is to be used in three different states. Along with this master document, I have three different sets of supplementary forms (Title Applications, for example) that need to be appended to the document depending on which state is selected (via check boxes on the cover page).
I've figured out how to make this work using templates and this code (placed under Actions; mouse up under the check box properties):
if(event.target.value!="Yes")
{this.getTemplate("NH_TITLEAPP").hidden=true;}
else
{this.getTemplate("NH_TITLEAPP").hidden=false;}
My problem is this; not all of my target users have Adobe Acrobat (most only have reader), and the "hidden" property does not work with Reader (why??).
I did try "spawning" the template pages which works just fine in Reader, however I could not figure out a simple way to get remove the added pages if someone checks a box by accident. Instead, when you "uncheck" the box the page just spawns again.
I am desperately searching for a workaround; either a way to let Reader "hide" the template; or a safe way to delete a spawned page by unchecking a check box.
Any help would be greatly appreciated! I've already spent hours trying to find a workaround... googling just isn't effective when it comes to something complicated like this.
Thank you!
After you spawn a template and find that you no longer need it, you can delete the page that was added using the doc.deletePages method, which works with Reader for pages that have been added by spawning a template.
If unchecking a check box causes that page to be spawned again, then you need to reconfigure or reprogram the Mouse Up action so that it spawns the template when selected, and deleted the page when unchecked.
Copy link to clipboard
Copied
This is a User 2 User forum. Most of the responders here do not have access to Adobe's plans or development.
Spawning template with Reader is very new, so users with versions prior to XI will not be able to even spawn pages from templates.
If you think this is needed use the Bug Report Feature Request at Adobe.com.
Copy link to clipboard
Copied
Thanks for your response. I am a little confused though. I don't need access to Adobe's plans or development; I just need help finding a code that works However I will absolutely request a feature as I don't understand why they would phase out the "hidden" property.
Copy link to clipboard
Copied
After you spawn a template and find that you no longer need it, you can delete the page that was added using the doc.deletePages method, which works with Reader for pages that have been added by spawning a template.
If unchecking a check box causes that page to be spawned again, then you need to reconfigure or reprogram the Mouse Up action so that it spawns the template when selected, and deleted the page when unchecked.
Copy link to clipboard
Copied
Thanks for your response. I understand that I need to reconfigure the Mouse Up Action using something like the doc.deletePages method. However, using the deletePages method requires knowing which page number to delete; correct? As I have multiple template pages that are added to the document dependent upon user choices, the page numbers are not always going to be the same.
Copy link to clipboard
Copied
When you spawn a page, it often includes form fields. A script can check to see if a particular field is on more than just a template page by looking at the "page" field property. So you can easily determine which page(s) were created by spawning a template and then delete the one(s) that need deleting. If you rename the fields when spawning, you can set up a separate template that includes just a single field and spawn it so that it's an overlay on the previously created page and choose not to rename the field when spawned.
So the process is:
1. Spawn template to create a new page and rename the fields
2. Spawn a different template as an overlay on the page created in step 1, but don't rename the fields
Let's suppose the second template has a single button named template1_id. You can find which pages have that field on it using code like:
var pages = getField("template1_id").page;
This will either return a number (-1) or an array of numbers (e.g., [-1, 5]). A value of -1 means that the field is on a hidden template. If it's an array, you know that the corresponding template has been spawned and you know the page numbers of the pages that were created when the template was spawned. You simply use those page numbers with the doc.deletePages method if you need to delete the pages.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now