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.
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;
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;
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.
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;
Copy link to clipboard
Copied
Thanks! Where would I add this script? The document script?