Skip to main content
Participating Frequently
December 12, 2024
Answered

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

  • December 12, 2024
  • 1 reply
  • 200 views

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 has been closed for replies.
Correct answer try67

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"]);

 

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
December 12, 2024

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"]);

 

Participating Frequently
December 12, 2024

It works great! Thank you!