How to auto populate PDF dropdown list selection based on the selection of another dropdown list

New Here ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

I have three dropdown boxes (dropdown A, dropdown B, and dropdown C). How can I get the selection in one to pull information from another and populate in another? For example I have 20 name selections in dropdown A. I have two options in dropdown B which are "yes" or "no". And I have 15 name selctions in dropdown C.

This is what I'm trying to accomplish:

If a user selects "yes" from dropdown B, I would like it to automatically pull their name selection from dropdown A, and input it into dropdown C.  However, if the user selects "no" in dropdown B, they would be able to manually select from the 15 names in dropdown C. 

TOPICS
Create PDFs, Edit and convert PDFs, How to, JavaScript, PDF forms

Views

87

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 , Mar 01, 2021 Mar 01, 2021
As the custom calculation script of dropdown C you can use the following code: if (this.getField("B").valueAsString=="yes") event.value = this.getField("A").valueAsString;

Likes

Translate

Translate
Most Valuable Participant ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

As the custom calculation script of dropdown C you can use the following code:

if (this.getField("B").valueAsString=="yes") event.value = this.getField("A").valueAsString;

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 ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Thank you so much! You've answered a lot of my questions over the years. I am using this page as a template. I've created a button that poultates a new page from this template and changes each field value so they aren't linked. Is there a way to add this scrip to the page since whenever I populate a new page those form fields will no longer be called "B" but will be B1, B2, B3, etc.

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 ,
Mar 01, 2021 Mar 01, 2021

Copy link to clipboard

Copied

Glad to hear it!

If the other fields are also named the same, then yes. Try this:

 

var fieldNumber = event.target.name.replace("C", "");
if (this.getField("B"+fieldNumber).valueAsString=="yes") event.value = this.getField("A"+fieldNumber).valueAsString;

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 ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

LATEST

Thanks! Where would I add this script? The document script?

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