Skip to main content
Participant
June 27, 2017
Answered

Where do I put the document level javascript?

  • June 27, 2017
  • 2 replies
  • 1710 views

I am fairly new to creating forms via Acrobat. This form is a questionnaire meant to be distributed to many different clients.

I haven't had any issues creating it, and it looks fine, I'm just encountering one major issue. I'm trying to insert a dropdown (i.e. Business Unit) ... Upon choosing a business unit from the dropdown, I would like that to reveal a new dropdown with options shown based on the user's previous selection. (i.e. Business Unit 1 only shows NY, NJ & PA as the choices, whereas choosing Business Unit 2 would reveal CA, NV & AZ....etc)

I believe I have written the correct javascript to execute an action like this, however I do not think I am putting it in the right place or understand where the right place to drop this is. If someone could help walk me through this, and verify that I am headed in the right direction - any help would be MUCH appreciated!

Thank you

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

I created a sample that makes this much easier. You can just copy the drop downs out of the form and edit them to your needs. See the URL below.

http://practicalpdf.com/dependent-lists/

2 replies

Joel Geraci
Community Expert
Joel GeraciCommunity ExpertCorrect answer
Community Expert
June 27, 2017

I created a sample that makes this much easier. You can just copy the drop downs out of the form and edit them to your needs. See the URL below.

http://practicalpdf.com/dependent-lists/

Participant
June 27, 2017

Thanks so much! This was exactly what I was looking for, and have been struggling for a few days with. Problem solved!

try67
Community Expert
Community Expert
June 27, 2017

The location depends on the kind of code you wrote... If this script is associated with a single field you can place it under that field's appropriate action (Validation/Keystroke/etc.). If you want to put it in a function and have it as a doc-level script you can do so via Tools - JavaScript - Document JavaScripts.

Participant
June 27, 2017

Okay, so what I'm thinking is that it's a combination of both. I'll need to have a field level javascript inserted into the particular field, but then have that connect or communicate wit ha particular document level script where another trigger is executed. Does that sound correct? Because the validation comes from when a certain field is selected - then that triggers something else to happen in another field in the document which I believe needs to be coded into the document level.

try67
Community Expert
Community Expert
June 27, 2017

No, you can put everything under the field's event.