Skip to main content
Participant
March 1, 2021
해결됨

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

  • March 1, 2021
  • 1 답변
  • 5712 조회

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. 

이 주제는 답변이 닫혔습니다.
최고의 답변: try67

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;

1 답변

try67
Community Expert
try67Community Expert답변
Community Expert
March 1, 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;

Participant
March 1, 2021

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.

try67
Community Expert
Community Expert
March 1, 2021

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;