I want to create an dropdown list that contains contingent/dynamic values.

New Here ,
Jun 24, 2018 Jun 24, 2018

Copy link to clipboard

Copied

I want to create a PDF that provides either content (text) or options contingent on the value chosen in a previous field.

1. First question; does this sound doable with javascript. 

For purposes of question one; here is a simple example

Assume a form with 2 fields; Size and Color.

For size, there are two options in a dropdown; "small" and "large"

If the user selects "small", then text options for color would be "red" and "green".

If the user selects "large", then text options for color would be  "black" and "white".

2. Where would one find documentation on the methods  available for Javascript within Acrobat. Or any documentation, for that matter?

TOPICS
Acrobat SDK and JavaScript, Macintosh

Views

169

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
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Jun 24, 2018 Jun 24, 2018
1. Yes, this can be achieved using a script.Here's the code for your example. It should be used as the custom validation script of the "Size" field:var colorField = this.getField("Color");if (event.value=="small") colorField.setItems(["red", "green"]);else if (event.value=="large") colorField.setItems(["black", "white"]);2. Here: Adobe - Acrobat Developer Center | Adobe Developer Connection

Likes

Translate

Translate
Most Valuable Participant ,
Jun 24, 2018 Jun 24, 2018

Copy link to clipboard

Copied

1. Yes, this can be achieved using a script.

Here's the code for your example. It should be used as the custom validation script of the "Size" field:

var colorField = this.getField("Color");

if (event.value=="small") colorField.setItems(["red", "green"]);

else if (event.value=="large") colorField.setItems(["black", "white"]);

2. Here: Adobe - Acrobat Developer Center | Adobe Developer Connection

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
community guidelines
New Here ,
Jun 25, 2018 Jun 25, 2018

Copy link to clipboard

Copied

Thank you for the direction. That will definitely get me headed the right way.

Another question:  The example I gave was a simplified version of what I really want to do (close enough though, that I can get it to work). However, with more complexity - would it be advisable to develop within Indesign and export to PDF?

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
community guidelines
Most Valuable Participant ,
Jun 25, 2018 Jun 25, 2018

Copy link to clipboard

Copied

LATEST

No. In fact, I would recommend doing all the fields work in Acrobat, including scripts.

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
community guidelines