Search code examples
javascriptpdfadobe

Adobe Acrobat: Is there a way to get rid of the arrow of a dropdown after selecting an option that does not lock selecting a different option?


I have found numerous articles with the same one person replying saying that this is impossible to do in Adobe Acorobat. I was wondering if there was some code I could right into the pdf that would allow the arrow of the dropdown to disappear without locking it and making it unable to be edited.

I found code that said it would work but it was only for being able to print it without any arrows. One the code resulted in errors and two printing it in my case locks the form anyways.


Solution

  • To achieve the effect you want, don't use a dropdown field. Instead, use a text field with a popup menu. Create a text field then add the following JavaScript to the OnFocus event in the Actions tab. See image for the Acrobat UI steps. The parameters in the popUpMenu method will build the menu to select from. Once selected, the value will show in the field. A working example is located here.

    var selection = app.popUpMenu("Dogs", "Cats", "Birds");
    event.target.value = selection;
    

    enter image description here