Skip to main content
Participant
November 9, 2023
Answered

Please help with JS for dropdown

  • November 9, 2023
  • 1 reply
  • 672 views

Hello, I have very little experience with JS and im trying to learn on my own as much as i can, I am trying to see how i can have multiple variables on a cascading drop down

 

 

var Itemlist = this.getField("Dropdown1","Dropdown2);

if(event.willCommit)
{
switch(event.value){

 

case "O2 Concentrator":
Itemlist.setItems([" ","No Filter","4-Way Valve","4-Way Valve Rebuild","4-Way Valve Rebuild (w/end caps)","4-Way Valve Rebuild (w/gasket)","4-Way Valve Rebuild (w/end caps & gasket)"]);

 

break;

 

case "Lift":


Itemlist.setItems([" ","2-Channel Hand Pendant","4-Channel Hand Pendant","Sling Clips (pck of 6)","Boot Boom","Emergency Pull Pin","Stop Button (Control Box)"]);

break;

 

case " ":
Itemlist.setItems([""]);

break;

}

}

This topic has been closed for replies.
Correct answer try67

This is not valid:

var Itemlist = this.getField("Dropdown1","Dropdown2);

 

You need to treat each field on its own:

var Itemlist1 = this.getField("Dropdown1");

var Itemlist2 = this.getField("Dropdown2");

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
November 9, 2023

This is not valid:

var Itemlist = this.getField("Dropdown1","Dropdown2);

 

You need to treat each field on its own:

var Itemlist1 = this.getField("Dropdown1");

var Itemlist2 = this.getField("Dropdown2");

FlotusAuthor
Participant
November 12, 2023

Thank you so much!