Skip to main content
Known Participant
March 28, 2017
Answered

app.response with argument based on user's input

  • March 28, 2017
  • 1 reply
  • 1361 views

based on this tutorial: https://acrobatusers.com/tutorials/popup_windows_part2 ,

i would like to use a button where a pop-up response box appears where it ask for a password before Submitting the form.

var cRtn = app.response ({ cQuestion:"Enter the password to Submit this form:", bPassword:true, cDefault: "test", cLabel:"Password"});

if(cRtn && cRtn.length) {

    // Code to submit form

} else app.alert("incorrect password");

i haven't used app.response yet, so I don't know the work around for this one.

Thanks in advance

This topic has been closed for replies.
Correct answer try67

Change this part of the code:

if (cRtn && cRtn.length) {

}

To:

if (cRtn && cRtn=="12345") {

     this.mailDoc({cTo: "me@email.com" });

}

Replace the values I entered with the actual password and email address that you want to use, of course.

1 reply

Joel Geraci
Community Expert
Community Expert
March 28, 2017

What exactly are you trying to accomplish? The password would need to be be stored in clear text and can easily be discovered by viewing the document JavaScripts.

If you're looking to limit the submissions to people who know the document open password, just set a document open password, you can't submit what you can't open.

iammundAuthor
Known Participant
March 28, 2017

My Client just want to place a password so not every user can use the Submit button.

If we'll be using the code above, how can I check or compare if the inputted value is correct based on the condition given?

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
March 28, 2017

Change this part of the code:

if (cRtn && cRtn.length) {

}

To:

if (cRtn && cRtn=="12345") {

     this.mailDoc({cTo: "me@email.com" });

}

Replace the values I entered with the actual password and email address that you want to use, of course.