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

Adjust the pop-up window when select value from dropdownlist

Participant ,
Nov 10, 2023 Nov 10, 2023

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
1.3K
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
1 ACCEPTED SOLUTION
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 (nButton === 3) {
        this.closeDoc();
}

 

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

View solution in original post

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 ,
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 (nButton === 3) {
        this.closeDoc();
}

 

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

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

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 🙂

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

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

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

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

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

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

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

Thanks alot 🙂

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