2 Replies Latest reply on Apr 7, 2016 12:55 PM by RDY 85

    How can I create a dynamic drop down list that controls two separate drop down lists?

    RDY 85

      Hello,

       

      I could use some help deciphering how to control 2 separate drop down lists (i.e. "b" and "c") through the selected value in the primary drop down (i.e "a").

      My script worked perfectly to control one other drop down list, however I cannot get it to properly control the third box.

       

      In my example below, what I am trying to do is control both "Method - External" and "Department - External" through my primary drop down list. The "Method - External" drop down is working fine, it's the third "Department - External" that I am struggling with.

       

      For instance, if "Theft" is chosen in the primary drop down, I want "Method - External" to display the set Items and "Department - External" to display another set of Items. If "Cyber Crime" is selected in the Primary drop down, then the "Method - External" set items will change and the "Department - External" will show N/A.

       

      With the following script - No matter what if I choose "Theft" or "Cyber Crime" in the primary drop down, the "Cyber Crime" N/A set items are displayed in the "Department - External" drop down.

       

      I apologize if this is hard to follow - It is definitely hard to explain. I hope my question came through.

       

      Below is my current script

       

      switch (event.value) {

          case "Theft":

              this.getField("Method - External").setItems(["","Grab and Run","Cart/Basket Walk Out","Concealment","Consumption","Other"]);

              break;

              this.getField("Department - External").setItems(["","Agro","Automotive","Bakery","Building Materials","Chemical","Cleaning Supplies","Confectionary","Dairy","Deli/Bistro","Electrical","Electronics","Farm Equipment","Fashion","Feed","Fertilizer"]);

              break;  

          case "Fraud":

              this.getField("Method - External").setItems(["","Credit Card","Debit Card","Check","Coupon","Counterfeit Currency","Merchandise Return","Price Switching","Self Check-out","Vendor","Other"]);

              this.getField("Department - External").setItems(["","N/A"]);

              break;   

          case "Robbery":

              this.getField("Method - External").setItems(["","Concealed Weapon Threat","Drawn Weapon Threat","Verbal Threats","Aggressive Actions","Other"]);

              break; 

          case "Break and Enter":

              this.getField("Method - External").setItems(["","Smash and Grab - Vehicular","Smash and Grab - Pedestrian","Forced Entry", "Unauthorized Keyed Entry","Other"]);

              break;

          case "Mischief":

              this.getField("Method - External").setItems(["","Graffitti","Property Damage","Product Tampering","Other"]);

              break;

          case "Cyber Crime":

              this.getField("Method - External").setItems(["","Malware (Virus)","Phishing Scam","Other"]);

              break;

              this.getField("Department - External").setItems(["","N/A"]);

              break;  

      }

       

      Thank you

        • 1. Re: How can I create a dynamic drop down list that controls two separate drop down lists?
          George_Johnson MVP & Adobe Community Professional

          You have some break statements that shouldn't be there. Try this:

           

          switch (event.value) {

          case "Theft":

              this.getField("Method - External").setItems(["","Grab and Run","Cart/Basket Walk Out","Concealment","Consumption","Other"]);

              this.getField("Department - External").setItems(["","Agro","Automotive","Bakery","Building Materials","Chemical","Cleaning Supplies","Confectionary","Dairy","Deli/Bistro","Electrical","Electronics","Farm Equipment","Fashion","Feed","Fertilizer"]);

              break; 

          case "Fraud":

              this.getField("Method - External").setItems(["","Credit Card","Debit Card","Check","Coupon","Counterfeit Currency","Merchandise Return","Price Switching","Self Check-out","Vendor","Other"]);

              this.getField("Department - External").setItems(["","N/A"]);

              break;  

          case "Robbery":

              this.getField("Method - External").setItems(["","Concealed Weapon Threat","Drawn Weapon Threat","Verbal Threats","Aggressive Actions","Other"]);

              break;

          case "Break and Enter":

              this.getField("Method - External").setItems(["","Smash and Grab - Vehicular","Smash and Grab - Pedestrian","Forced Entry", "Unauthorized Keyed Entry","Other"]);

              break;

          case "Mischief":

              this.getField("Method - External").setItems(["","Graffitti","Property Damage","Product Tampering","Other"]);

              break;

          case "Cyber Crime":

              this.getField("Method - External").setItems(["","Malware (Virus)","Phishing Scam","Other"]);

              this.getField("Department - External").setItems(["","N/A"]);

              break; 

          }

          • 2. Re: How can I create a dynamic drop down list that controls two separate drop down lists?
            RDY 85 Level 1

            Simple as that. Right in front of my face.

             

            Thank you George