Where do I put the document level javascript?

New Here ,
Jun 27, 2017

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

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/

TOPICS
Acrobat SDK and JavaScript, Windows

Views

973

Likes

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

Where do I put the document level javascript?

New Here ,
Jun 27, 2017

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by Joel_Geraci | Adobe Community Professional

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/

TOPICS
Acrobat SDK and JavaScript, Windows

Views

974

Likes

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
Jun 27, 2017 0
Most Valuable Participant ,
Jun 27, 2017

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Jun 27, 2017 0
New Here ,
Jun 27, 2017

Copy link to clipboard

Copied

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.

Likes

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
Reply
Loading...
Jun 27, 2017 0
Most Valuable Participant ,
Jun 27, 2017

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Jun 27, 2017 0
Adobe Community Professional ,
Jun 27, 2017

Copy link to clipboard

Copied

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/

Likes

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
Reply
Loading...
Jun 27, 2017 2
New Here ,
Jun 27, 2017

Copy link to clipboard

Copied

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

Likes

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
Reply
Loading...
Jun 27, 2017 0