Skip to main content
michalz33808019
Participant
July 26, 2017
Answered

How to trigger script when value in dropbox is chosen

  • July 26, 2017
  • 1 reply
  • 831 views

Hello,

I'm using Acrobat Reader DC,

I've the dropdown list ("dropdown1") with 3 options, for each option I did some coding, for example for option "system support"

if (this.getField("Dropdown1").value == "System Support") {app.alert("WELCOME KIT\n" + "Essential support agreement information",4, 0, "System Support");}

It works, BUT when I choose in dropdown list "system support" the code is triggered AFTER I click anywhere in the pdf (it's not done with the click and I need it to be excecuted when I choose that "System support" option).

In options of the dropdown list I've selected "commit selected value immidieatly" but I'm missing something...I tried some ideas in the internet like:

if(event.willCommit)
{
  
switch(event.value)
  
{
  
case "System Support":
    {app.alert("WELCOME KIT\n" + "Essential support agreement information",4, 0, "System Support");}
;
  
break;

I believe I'm doing something wrong. Could you please help me?

This topic has been closed for replies.
Correct answer try67

Delete all other actions you added. Just use this one, as the custom validation script.

If it still doesn't work, share the file (via Dropbox, Google Drive, Adobe Cloud, etc.).

1 reply

try67
Community Expert
Community Expert
July 26, 2017

Use the Validation script and replace this part of your code:

this.getField("Dropdown1").value

With:

event.value

michalz33808019
Participant
July 26, 2017

Hey,

I just tried:

if (event.value == "System Support") {app.alert("WELCOME KIT\n" + "Essential support agreement information",4, 0, "System Support");}

It's still working the same. I should also mention that in actions of that dropdown list, I've selected trigger "on blur", mainly because mouse up/down/enter/exit and on focus is not working with the dropdown list correctly.

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
July 26, 2017

Delete all other actions you added. Just use this one, as the custom validation script.

If it still doesn't work, share the file (via Dropbox, Google Drive, Adobe Cloud, etc.).