Known Participant
September 27, 2022
Answered
Dependent Drop Down List not working
- September 27, 2022
- 2 replies
- 2672 views
I have created two drop-down lists on my form, the master is called Department and the dependent is called Division.
When someone selects a department, such as "CAO", the Division drop-down should include options such as "HR", "Comms", or "Ec Dev" to select from.
The following is the Java Script that I have entered into the Custom Keystroke Script area of the Department drop-down list properties, which I based on this youtube video https://www.youtube.com/watch?v=QTWDw0va2D4 but it doesn't seem to be working. Although I'm not getting any error messages, nothing is populating in the Division drop-down.
Could someone please help me figure out what I'm missing? Did I put the script in the wrong area?
Thanks!
var DivisionList = this.getField("Division");
if(event.willCommit)
{
switch(event.value){
case "CAO":
DivisionList.setDivision(["-select CAO-", "HR", "EcDev", "Communications"]);
break;
case "Community Services":
DivisionList.setDivision(["-select Community Services-", "Facilities & Parks", "Cemeteries", "Project Management", "Public & Open Spaces", "Recreation & Culture", "Cultural Development"]);
break;
case "Corporate Services":
DivisionList.setDivision(["-select Corporate Services-", "Legislation", "Clerks"]);
break;
case "Finance, Administration & Innovation":
DivisionList.setDivision(["-Finance, Administration & Innovation-", "Finance", "Tax Billing", "Accounting", "Procurement", "IT Services", "Utility Billing"]);
break;
case "Fire & Emergency Services":
DivisionList.setDivision(["-Fire & Emergency Services-", "Fire Suppression", "Fire Prevention"]);
break;
case "Planning & Development":
DivisionList.setDivision(["-Planning & Development-", "By-Law", "Planning", "Building"]);
break;
case "Public Works":
DivisionList.setDivison(["-Public Works-", "Climate Change", "Environmental Services", "Project Manager's Office", "Roads & Fleet", "Technical Services", "Transit", "Water & Waste Water"]);
break;
default:
DivisionList.setDivision([""]);
break;
}
}