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

Adjust the pop-up window when select value from dropdownlist

Explorer ,
Nov 10, 2023 Nov 10, 2023

Copy link to clipboard

Copied

Hi,

Please would like your help, I'm using the following applied on a dropdownlist:
------------------------------------------------

var nButton = app.alert({
cMsg: "Do you agree to the terms and conditions specified by your user agreement with XYZ Corporation?\n\n If you click No, the document will close.",
cTitle: "Legal Notice",
nIcon: 2,
nType: 2
});

if (nButton === 3) {
this.closeDoc();
}
------------------------------------
I don't know how to customize it to appear when user select a specific value in the list. In addition, if user "agreed" how to unhide a text in the document to show its agreed.

Sorry if its too much but appreciate your great help

TOPICS
How to , JavaScript , PDF , PDF forms

Views

907

Translate

Translate

Report

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 , Nov 10, 2023 Nov 10, 2023

First things first.  Put the code in the custom validation script for the dropdown.

Surround your code with an "if" block that keys off of the selection that needs to display the message. 

if(event.value == "Selection")
{
    var nButton = app.alert({
        cMsg: "Do you agree to the terms and conditions specified by your user agreement         with XYZ Corporation?\n\n If you click No, the document will close.",
        cTitle: "Legal Notice",
        nIcon: 2,
        nType: 2
   });

    if
...

Votes

Translate

Translate
Community Expert ,
Nov 10, 2023 Nov 10, 2023

Copy link to clipboard

Copied

First things first.  Put the code in the custom validation script for the dropdown.

Surround your code with an "if" block that keys off of the selection that needs to display the message. 

if(event.value == "Selection")
{
    var nButton = app.alert({
        cMsg: "Do you agree to the terms and conditions specified by your user agreement         with XYZ Corporation?\n\n If you click No, the document will close.",
        cTitle: "Legal Notice",
        nIcon: 2,
        nType: 2
   });

    if (nButton === 3) {
        this.closeDoc();
}

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
Explorer ,
Nov 10, 2023 Nov 10, 2023

Copy link to clipboard

Copied

Thanks a lot, this works :))))
How to show the hidden text now after the user agreed? is that possible? (basically the text to confirm the choice)

Sorry for many questions 🙂

Votes

Translate

Translate

Report

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 ,
Nov 10, 2023 Nov 10, 2023

Copy link to clipboard

Copied

Where is the hidden text? Is it in a text field or text annotation?  

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
Explorer ,
Nov 10, 2023 Nov 10, 2023

Copy link to clipboard

Copied

Thanks @Thom Parker its a text field to confirm the choice of the user

Votes

Translate

Translate

Report

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 ,
Nov 11, 2023 Nov 11, 2023

Copy link to clipboard

Copied

Just unhide the field based on the button choice. 

Here's an article on the topic:

https://www.pdfscripting.com/public/Hiding-and-Showing-Form-Fields.cfm

 

this.getField("PopupText").display = (nButton == 4)?display.visible:display.hidden;

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

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
Explorer ,
Nov 12, 2023 Nov 12, 2023

Copy link to clipboard

Copied

LATEST

Thanks alot 🙂

Votes

Translate

Translate

Report

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