Copy link to clipboard
Copied
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
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.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
it works thanks
can I remove the cDefault in the code? what is it anyway?
Copy link to clipboard
Copied
It's the value that appears in the text field in the response window by default. Yes, you can remove it, and then the field will be empty.
Copy link to clipboard
Copied
great thanks.
got confused with the if(cRtn && cRtn.length), forgot that it was just a if-else statement.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now