0 Replies Latest reply on Jun 20, 2013 8:53 AM by Haiko Oosterbaan

    Multiple dependent dropdown lists with the same content on one page

    Haiko Oosterbaan

      Hi,

       

      I've read the different discussions so far about dependent dropdown lists.

      I've got it to work with one list, but need about 18 of these dropdown lists, all with the same content, on one page which all can be used separately and I can't figure out how to do it, if even possible.

      (It's part of a bigger form.)

       

      My script is based on this discussion:

      http://forums.adobe.com/message/3012567

       

      keystroke script box 1:

       

      if( event.willCommit )

      {

         if(event.value == "")

           //if nothing is chosen in box1 then box2 will be cleared

           this.getField("box2").clearItems();

         else

          SetFieldValues(event.value);

      }

       

      keystroke script box 3:

       

      if( event.willCommit )

      {

         if(event.value == "")

           //if nothing is chosen in box3 then box4 will be cleared

           this.getField("box4").clearItems();

         else

          SetFieldValues(event.value);

      }

       

       

      and adjusted the document Javascript:

       

      //First you make the values for box1.

      myBox1Values = ["", "a", "b"];

      myBox3Values = ["", "g", "h"];

       

        //Then you populate the values to box1.

      this.getField("box1").setItems(myBox1Values);

      this.getField("box3").setItems(myBox1Values);

       

      // Then you define what has to be shown in box2 when value is selected

      var DeptData = { a: ["C","D"],

                       b: ["E","F"],

                       g: ["I","J"],

                       h: ["K","L"]

                      };

       

      //Finally you set the values of box2

      function SetFieldValues(cDeptName)

      {

        this.getField("box2").setItems(DeptData[cDeptName]);

        this.getField("box4").setItems(DeptData[cDeptName]);

       

      }

       

       

      This doesn't work. When changing the value in box1 or box3, both box2 and box4 change.

       

      Has anyone got an idea how to solve this?

       

      Thanks, Haiko.