Skip to main content
Inspiring
November 10, 2023
Answered

Adjust the pop-up window when select value from dropdownlist

  • November 10, 2023
  • 1 reply
  • 1688 views

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

This topic has been closed for replies.
Correct answer Thom Parker

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();
}

 

1 reply

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
November 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 PDFScriptingUse the Acrobat JavaScript Reference early and often
KaxkulAuthor
Inspiring
November 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 🙂

Thom Parker
Community Expert
Community Expert
November 10, 2023

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

 

 

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