Skip to main content
johnf3870857
New Participant
September 10, 2016
Answered

How can I password-protect a text-field button?

  • September 10, 2016
  • 4 replies
  • 8212 views

Using Adobe Acrobat DC.

A final button on page one is titled: 'Next Page: ADMIN only'.

How can I password protect the button to where if a student clicks on the button, a password box would pop up (so that access to the next page is restricted to admin personnel only)?

Thanks in advance!

This topic has been closed for replies.
Correct answer johnf3870857

Thank you ALL for you insightful wisdom and input to this.

And thank you, gkaiseril, for throwing in a sample script. Indeed, I will commence my Great Experiment and see what I see.

FYI to all: this is not a sensitive or confidential security matter in that the admin page simply duplicates the students Content-area entries from page one (so that our admin person can review the content for final save/printout/distribution)....so even if a student somehow got around the password protection of the hidden page template, for example, no harm no foul, lol.

Thanks again to ALL of you for your wonderful assistance on this!

John

4 replies

Braniac
June 29, 2019

What would stop the student just scrolling to the next page and ignoring your button? And what would happen if the student turned off JavaScript?

Braniac
September 11, 2016

Yes, but the JavaScript used when the password is entered is also going to be in the PDF... I'm not going to elaborate on hacking techniques though.

Inspiring
September 12, 2016

Here is a sample scrip that uses the hashString encoded password.

var cTest = app.response({cQuestion: "Enter password:", cTitle: "Password Request", bPassword: true, cLabel: "Password:"});

if(cTest != null) {

var cTestPassword = Collab.hashString(cTest);

if("f1Ez7o1plZdHDei34K4zZC" == cTestPassword)

{

app.alert("valid password", 3, 0);

}

else

{

app.alert("Invalid password", 0, 0);

} // end cTest;

} // end cResponse not null;

One could add a check for the login  name to add another layer of protection and add a password to lock editing of the form.

The string "f1Ez7o1plZdHDei34K4zZC" is obtained by running the Collab.hashString() method in the JavaScript console and it is unique to the required password.

Additional security could be added by not adding the template until the form is returned or moving the data from the returned form to a copy of the form with the template.

try67
Braniac
July 2, 2019

try67, I tried to mark your answer as correct, but since we're in someone else's thread, it won't let me! Should I start a new thread so you can get credit for your work? I will if you say so!


No, that's fine... It's not worth the trouble. Just glad to hear it worked!

Inspiring
September 11, 2016

You can set up the form so that the admin-only page is a hidden template and spawn it when the correct password is entered so that is creates a new page. Whether this is a viable approach depends on how secure it needs to be.

johnf3870857
New Participant
September 11, 2016

Fascinating work around, thanks for your suggestion. I setup the admin page as a hidden template (which I just did) and will now try to figure out how to create a JavaScript so that it spawns the hidden template as a visible new page, once the document password is entered....is that what you are saying?

Inspiring
September 11, 2016

Yes. The button would have a script that prompts the user for a password and spawns the template if it matches.

You can use the undocumented Collab.hashString method so you don't have to store the actual password in the document.

Inspiring
September 10, 2016

You cannot. You can use JavaScript to lock it, but JavaScript can turned off. Also one can use JavaScript in Reder to list all form fields.