Skip to main content
Inspiring
February 13, 2018
Answered

How to change a javascript for websites into a javascript that works in acrobat?

  • February 13, 2018
  • 1 reply
  • 1643 views

Hello everybody,

I have attached a script that I would like to integrate into a PDF. The PDF has a textfield (called: input) to which I want to assign this script. Can anyone help me to embed this script? It works flawlessly via the browser. How can I use this script for websites in Acrobat? I have no experience with javascript in Acrobat, only a little using javascript in websites.

Thank you very much

Here is my script I want to include:

https://www.w3schools.com/howto/howto_js_autocomplete.asp

This topic has been closed for replies.
Correct answer Joel Geraci

Yeah - I saw that when I looked again. I saw the PHP reference and thought it was happening on the server. How familiar are you with JavaScript. If you are familiar, look at the setItems method for a combo box field. Just filter the array by the value of the field after reach keystroke event.

Acrobat DC SDK Documentation 

1 reply

Joel Geraci
Community Expert
Community Expert
February 13, 2018

The functionality is certainly possible in Acrobat javascript. However, the script you reference is essentially useless for Acrobat though. The object and event models are completely different and you'll need to recreate the functionality from scratch. The only major question I have is this... do you need the array of countries to be read from a server, as in your example, or can they be embedded in the JavaScript code?

Elsje2002Author
Inspiring
February 13, 2018

thanks for your message so quickly. No the array of countries should be embedded in the JavaScript code.

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
February 13, 2018

Yeah - I saw that when I looked again. I saw the PHP reference and thought it was happening on the server. How familiar are you with JavaScript. If you are familiar, look at the setItems method for a combo box field. Just filter the array by the value of the field after reach keystroke event.

Acrobat DC SDK Documentation