Skip to main content
Chinacracker
Participating Frequently
February 20, 2020
Answered

Adobe Acrobat DC Form problem with Dropdown and if/else statement

  • February 20, 2020
  • 2 replies
  • 4551 views

Hello there,

i made a dropdown menu with 4 things to choose. I wrote a code to hide further fields or to show them when "private request" is selected. But it seems it does these things just randomly. Where is my mistake? Thank you! Please see the video.

 

https://streamable.com/s/dp55r/idkpnl

 

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

First, the dropdown field needs to be set to "Commit selection immediately", on options tab.

Next, do not use a mouseUp. Put your script in the validate event and replace "event.target.value" with "event.value"

Repeat: Do not use the MouseUp, and Do not use "event.target.value"

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
February 21, 2020

First, the dropdown field needs to be set to "Commit selection immediately", on options tab.

Next, do not use a mouseUp. Put your script in the validate event and replace "event.target.value" with "event.value"

Repeat: Do not use the MouseUp, and Do not use "event.target.value"

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Chinacracker
Participating Frequently
February 21, 2020

Hi Thom Parker,

 

I appreciate your quick help. Thank you! I followed your instructions. Unfortunately, it still does not work. The video I uploaded yesterday got resized automatically by the host and the quality was very bad. This time I tried another platform to have good quality. I hope to find a solution. I have a Mac. OS Mojave.

 

https://gofile.io/?c=VDQO3t

 

if (event.value == "private") { this.getField("privatefirstquestion").display = display.visible; } else { this.getField("privatefirstquestion").display = display.hidden; }

LinSims
Community Expert
Community Expert
February 20, 2020

Let me move this to the Acrobat forum for you, where you are more likely to receive an answer to your question.

Note that the Community Help forum is for help in how to use the Adobe Communities. Product questions should be posted in the associated product community.

 

You can help the people in the Acrobat forum help you by adding the following to your post:

 

Computer type (Mac or PC)

OS

 

And, probably, the section of code you think is at issue. I expect that will be of more use than the video link.

 

As an FYI, you can embed the video into your post using the Insert video button in the editing bar.

Chinacracker
Participating Frequently
February 20, 2020

ok thx