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?
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
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
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?
Copy link to clipboard
Copied
No. In fact, I would recommend doing all the fields work in Acrobat, including scripts.