Skip to main content
Participating Frequently
March 12, 2025
Question

dependent drop down need multiple options

  • March 12, 2025
  • 1 reply
  • 672 views

Hello-

I have a parent dropdown with 3 dependents but I need only some items to show when certain items are selected.  Code it quite long so here is a bit........what I need is when None is selected from the first dependant list, I only need 2 options to show, where as if any other selection is made I still need all options so show.

The highlighted items are what I need visible:

var f = this.getField("Additional Capabilities");

 

switch(event.value)

{

case "Absolute Pressure Decay, Occlusion, Verify":   This is the parent dropdown

   f.setItems(["-Select Additional Capability-",

"None",  when this is selected

"Mass Flow",

"Ramp to Event",

"Mass Flow & Ramp to Event",

"Volumetric",

"Low Volume"]);

break;

case "Differential Pressure Decay, Occlusion":

 

var f = this.getField("Transducer Range");

 

switch(event.value)

{

case "Absolute Pressure Decay, Occlusion, Verify":

   f.setItems(["-Select Transducer Range-",

"20 psia",

"45 psia",

"115 psia",

"215 psia",

"515 psia",

"other"]);  I only need these 2 options selected, otherwise the entire list should show

break;

 

How do I make logic inside of logic if that makes sense?   

 

Thank you so much, hope this make sense.

Nora

 

1 reply

try67
Community Expert
Community Expert
March 12, 2025

Use this code (adjust the values as needed of course) as the field's custom Validation script:

 

var f = this.getField("Transducer Range");
if (event.value=="None")
	f.setItems(["Option 1", "Option 2"]);
else f.setItems(["Option 3", "Option 4", "Option 5", "Option 6"]);
Participating Frequently
March 12, 2025

Thank you---  I added/changed the code to the above and it changed the 2 dependent field to show 20 psia instead of staying at Select Transducer Range so I made a small adjustment and corrected that but it still shows the fill list of options, not just the 2 that I need:

var f = this.getField("Additional Capabilities");
 
switch(event.value)
{
case "Absolute Pressure Decay, Occlusion, Verify":
   f.setItems(["-Select Additional Capability-",
"None",
"Mass Flow",
"Ramp to Event",
"Mass Flow & Ramp to Event",
"Volumetric",
"Low Volume"]);
break;
case "Differential Pressure Decay, Occlusion":
   f.setItems(["-Select Additional Capability-",
"None",
"Mass Flow",
"Ramp to Event",
"Mass Flow & Ramp to Event"]);
break;
case "Differential Mass Flow":
f.setItems(["-Select Additional Capability-",
"none"]);
break;
 
default:
  f.setItems([]);
  break;
 
}
 
switch(event.value)
{
case "Absolute Pressure Decay, Occlusion, Verify":
var f = this.getField("Transducer Range");
if (event.value=="None")
f.setItems(["515 psia", "Other"]);
 
else f.setItems(["-Select Transducer Range-",
"20 psia",
"45 psia",
"115 psia",
"215 psia"]);
break;

 

Do I need to put code in a different order?

try67
Community Expert
Community Expert
March 12, 2025

Replace all of your code with what I provided, only.