Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Making a password show what parts of the document you see

Avatar

Level 2

I have a random request from a client that I am not sure is even possible.

They want their document to be used by two people, one of them will only be able to see say 4 pages of it while the other will be able to see it all including what the person before had entered.

I think you can get around the text part quite easily but to have it show different parts of the form via a password is very hard for me to do (even if it is possible at all)

Can anyone lend me a hand in this?

If you need me information feel free to ask.

1 Reply

Avatar

Level 4

It sure is possible. I have been doing it for quite some time now and this would be a perfect situation for the Action Builder if coding in FormCalc is not your thing, but I can give you both.. I will use a sample form for the demo so if the lingo doesn't match up to your form, let me know or if you need an example. If anyone has anything simpler or I missed something, let me know. PM me if you want a sample form.

Create a new PDF and add in a second blank page and set that page to hidden in the Object field. Place a text field on page 1. Go to the Action Builder (in Windows go to the toolbar at the top, then "Tools" then select "Action Builder". The Action Builder is a great tool to add some extra functions into your PDFs with the preset actions. From the Action Tool box select the "Add New Item" from the top left of the box, right next to the trash can icon. This will create a new Action. There are 2 things for the Action: a condition and then a result. In the Condition section click the "object" link and then select the text field you put on page 1. Once you select the text field, the Condition box will change to "when text field TextField1...." and there will be 2 drop down boxes. With the condition set as "Is" put your password in the blank field. Then in the Result section select the drop down box and go to "Show/Hide an Object"and then select Page 2. What this will do is when TextField1 is equal to your password, page 2 will be visible. You can do this with not only a page, but specific elements within the PDF. So additional Textfields, pages, static text or other elements. One thing to keep in mind is what I like to call "foward/backwards logic" in that a user can enter the password to show the data, then remove it to hide whatever. Just go back through the Action Builder in reverse order that you did, where when TextField1 IS NOT the password, set the elements to hidden.

If you can do this via Formcalc, the setup would be similar, but instead of using the Action Builder you could do something like, create a numericField that has a number based password. On that field, go to your Script Editor, select "Change: from the show section, change the Language to FormCalc and then enter:

if ($.rawValue==1)then

xfa.resolveNode("Page1).presence = "visible"

else xfa.resolveNode("Page1").presence = "hidden"

endif

The bolded 1 is the password. The second and third lines cover what you want hidden or visible. So change whatever you want the password to, change the hidden and visible sections and then give it a try. You could even set this on a docReady show option as well to check that field when the form is opened if perhaps the first person saved the PDF with the hidden sections open. That way they do not need to enter the password every single time. Of course before they send it they should remove the password. Just be ready that whenever the user opens the form, even if they do not change anything, they will be prompted to save.