Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

app.response with argument based on user's input

Community Beginner ,
Mar 28, 2017 Mar 28, 2017

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

TOPICS
Acrobat SDK and JavaScript
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 28, 2017 Mar 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.

Translate
Community Expert ,
Mar 28, 2017 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 28, 2017 Mar 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2017 Mar 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 28, 2017 Mar 28, 2017

it works thanks

can I remove the cDefault in the code? what is it anyway?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 28, 2017 Mar 28, 2017

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 28, 2017 Mar 28, 2017
LATEST

great thanks.

got confused with the if(cRtn && cRtn.length), forgot that it was just a if-else statement.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines