Skip to main content
Inspiring
July 9, 2019
Answered

How can I make a password entry "hashed"?

  • July 9, 2019
  • 1 reply
  • 1001 views

First, I may not be using the correct terminology. I want to have the password displayed as asterisks as it is being entered—that's what I'm calling "hashed."

try67 gave me an excellent, simple script to protect the text field in question with a password, but it doesn't conceal the password with asterisks while it's being input (I didn't think to ask for that). I don't know anything about sql or php, so I'm hoping there is a simple line or three of js that can do this for me. Here's what I have so far:

The 'Score' field is the one in question, and here is the line of code try67​ was kind enough to provide and which works just fine:

event.rc = (app.response("Enter the password:","","")=="1234"); //where "1234" is the password.

This is placed as a custom validation script in the field's properties modal.

When the js alert window pops up, it automatically places the cursor in the password entry field, which is great (another script I tried didn't), but when I enter the password, the characters are all plain text.

Now, I appreciate all the people on these forums that spend their time helping us newbies out, and I HAVE spent literally hours searching for a similar-enough question to help, as well as the Acrobat API reference for the correct syntax, as well as trying to modify other pw-protection scripts to make them work [modifying them and combining them with the above line of code]—in other words, I DID try to figure this our for myself, but I have just come up short.

I realize those of you who know coding are probably laughing at me, and that's okay, but I would really appreciate help with this, please.

Thanks in advance!

Ken

This topic has been closed for replies.
Correct answer try67

Use this:

event.rc = (app.response({cQuestion: "Enter the password:", cTitle: "", cDefault: "", bPassword: true})=="1234");

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 9, 2019

Use this:

event.rc = (app.response({cQuestion: "Enter the password:", cTitle: "", cDefault: "", bPassword: true})=="1234");

Inspiring
July 9, 2019

Thanks for coming to the rescue again, try67​!

This works! I know I might be considered "greedy," but I am creating this form for some picky people: Is there a way to make the cursor automatically be placed in the pw entry field like the first line of code you gave me did?

I am still marking your answer as correct, because this WILL do what I need, but the cursor placement would be a bonus.

Thanks so much, and much success!

try67
Community Expert
Community Expert
July 9, 2019

No, sorry, that's not possible, unless you use a Dialog object instead of an alert window, but those are much more complicated to create.