Skip to main content
Participating Frequently
Dec 12, 2024 3:30 PM UTC
Answered

Need help Auto-populating a dropdown list based on the selections of two other dropdowns

Hello,

I am new to javascript. I followed a tutorial to be able to autopopulate a dropdown based on another, but I don't know how to make it work based on the selections of two dropdowns.

I have 7 options in the first column (discipline), and 5 levels in the second column (level). Depending on what is selected in those two, I need to auto populate different options in the third row (power).

¿Could someone help me with that?

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Dec 12, 2024 5:25 PM UTC

This is tricky. You will need to add a script to both source fields. Something like this (under row1.discipline):

 

if (event.value=="Discipline1" && this.getField("row1.level").valueAsString=="Level1") this.getField("row1.power").setItems(["Item 1", "Item 2", "Item 3"]);

 

And then something like this under row1.level:

 

if (event.value=="Level1" && this.getField("row1.discipline").valueAsString=="Discipline1") this.getField("row1.power").setItems(["Item 1", "Item 2", "Item 3"]);

 

2 replies

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Dec 12, 2024 5:25 PM UTC

This is tricky. You will need to add a script to both source fields. Something like this (under row1.discipline):

 

if (event.value=="Discipline1" && this.getField("row1.level").valueAsString=="Level1") this.getField("row1.power").setItems(["Item 1", "Item 2", "Item 3"]);

 

And then something like this under row1.level:

 

if (event.value=="Level1" && this.getField("row1.discipline").valueAsString=="Discipline1") this.getField("row1.power").setItems(["Item 1", "Item 2", "Item 3"]);

 

Translate
Participating Frequently
Dec 12, 2024 7:11 PM UTC

It works great! Thank you!

Translate