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

How to trigger script when value in dropbox is chosen

New Here ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

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?

TOPICS
Acrobat SDK and JavaScript

Views

505

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 , Jul 26, 2017 Jul 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.).

Votes

Translate

Translate
Community Expert ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

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

this.getField("Dropdown1").value

With:

event.value

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
New Here ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

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.

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 ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

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.).

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
New Here ,
Jul 26, 2017 Jul 26, 2017

Copy link to clipboard

Copied

LATEST

It works!

Thank you

So the problem was that I didn't put my code in custom validation script but within action !

Thanks a lot !

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