Skip to main content
Inspiring
September 8, 2025
Answered

Switch Drop Down text fields javascript question

  • September 8, 2025
  • 1 reply
  • 206 views

I have a text field named 'EmpStatus1' and would like to switch the fields in drop downs named Exception1 and Exceptions2 .  How I'm doing it below I can only get the first drop down to switch (Exception1).  What can I do to get Exception2 to switch as well?  Thank you so much!

 

//Validate in EmpStatus1 text field
setDropdowns(this.getField("Exception1","Exception2"));

 

//JavaScript Documentation named Switch Fields
function setDropdowns(field){

switch (event.value) {
case "Regular":
field.setItems([" ","CDO","CDO Leave","CDO Banked (worked on CDO)","Stat Holiday","Stat Leave","Vacation","Sick","Sick No Pay","Family Sick","Leave No Pay","COT","POT","Compassion Leave","WCB Hours","Paid OT1.5","Paid OT2.0","Bank OT2.0","Bank OT1.5","Meal Break","Callout Paid2.0","Callout Bank2.0","Cashier","Farm Attendant","Section Manager"]);
break;
case "Temp":
field.setItems([" ","CDO","CDO Leave","CDO Banked (worked on CDO)","Stat Holiday","Stat Leave","Vacation","Sick","Sick No Pay","Family Sick","Leave No Pay","COT","POT","Compassion Leave","WCB Hours","Paid OT1.5","Paid OT2.0","Bank OT2.0","Bank OT1.5","Meal Break","Callout Paid2.0","Callout Bank2.0","Cashier","Farm Attendant","Section Manager"]);
break;
case "Auxilliary":
field.setItems([" ","Stat Leave","Sick","Sick No Pay","Leave No Pay","WCB Hours","Paid OT1.5","Paid OT2.0","Meal Break","Callout Paid2.0","Cashier (Aux)","Farm Attendant (Aux)"]);
break;
default:
field.clearItems();}
}

Correct answer Bernd Alheit

setDropdowns(this.getField("Exception1"));

setDropdowns(this.getField("Exception2"));

1 reply

Bernd Alheit
Community Expert
Community Expert
September 8, 2025

this.getField("Exception1","Exception2")

will give you only the first field.

Inspiring
September 8, 2025

Yes, is there a way I can get it switch the Exception2 as well?

Bernd Alheit
Community Expert
Bernd AlheitCommunity ExpertCorrect answer
Community Expert
September 8, 2025

setDropdowns(this.getField("Exception1"));

setDropdowns(this.getField("Exception2"));