Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
1

dependent drop down need multiple options

Community Beginner ,
Mar 12, 2025 Mar 12, 2025

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

 

TOPICS
JavaScript
296
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2025 Mar 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"]);
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 12, 2025 Mar 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2025 Mar 12, 2025

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 12, 2025 Mar 12, 2025

HI-  Yes -- when I make the first selection from the parent dropdown it changes the transducer field immediately

Nora26206859xo24_0-1741799674300.png

 

Then when I select the addtl capabilities as "none" option, I get the entire list where I only need 2 options

Nora26206859xo24_1-1741799741686.png

However, I need the entire list when selecting any of the options from the parent drop down.

 

I've attached a copy of the form if that helps see what is happening.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 12, 2025 Mar 12, 2025

I don't see you applied the code in the file you shared. I did, and it works fine. See attached.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 13, 2025 Mar 13, 2025
LATEST

Thank you.....   I may have taken it out since I needed a copy for a rush request and then sent you the wrong file.   I appreciate you looking, reviewing and adding code.  That is where I had it added so I must have had a small space or punctuation missing somewhere.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines