3 Replies Latest reply on Mar 30, 2010 9:49 AM by ppope7202

    Multiple comb boxes using same list (Acrobat Professional 9)

    ppope7202

      This seems like a basic question but I haven't been able to locate an answer. I have an application, similar to an order form in which I have 10 combo boxes - all with the same items. I want to be able to have one list, I assume in the first combo box, from which the other combo boxes pull from. So all 10 combo boxes will have the same list of items but I only maintain the list in one combo field. Is there a script for this? Thanks so much!

        • 1. Re: Multiple comb boxes using same list (Acrobat Professional 9)
          gkaiseril MVP & Adobe Community Professional

          You can create a JavaScript array of the items and values to be set into the combo boxes and then use Acrobat's JavaScript's ''setItems()' method to load the fields.

           

          Get various fields (combo or list) and set items in the list using various techniques.

           

          var l = this.getField("ListBox");

          l.setItems(["One", "Two", "Three"]);

           

          var c = this.getField("StateBox");

          c.setItems([["California", "CA"],["Massachusetts", "MA"],

          ["Arizona", "AZ"]]);

           

          var c = this.getField("NumberBox");

          c.setItems(["1", 2, 3, ["PI", Math.PI]]);

          • 2. Re: Multiple comb boxes using same list (Acrobat Professional 9)
            gkaiseril MVP & Adobe Community Professional

            First declare a variable for the array of items and populate it. Then use that array to set the contents of the combo boxes.

             

            var aItems = new Array(" ","4-H", "ANR", "FCS"); // define array of items for combo boxes

            var oComboBox = this.getField("Combo Box1"); // get combo box
            oComboBox.setItems(aItems); // set items from array

            oComboBox =  this.getField("Combo Box2"); // get combo box
            oComboBox.setItems(aItems); // set items from array

            oComboBox =  this.getField("Combo Box3"); // get combo box
            oComboBox.setItems(aItems); // set items from array

            oComboBox =  this.getField("Combo Box4"); // get combo box
            oComboBox.setItems(aItems); // set items from array

             

            • 3. Re: Multiple comb boxes using same list (Acrobat Professional 9)
              ppope7202 Level 1

              GKaiseril, thank you so much for your response. I tried your solution and its seems to work great. I'm such a newbie, however, I want to make sure I did this correctly. I simply copied your script, then in Professional 9, I click on Advanced / Document Processing / Document Java Scripts. In the dialogue box, I created a new script name, pasted your script into it, then click on Add to create the new script. I removed the existing item list I had for each combo box. Is that the correct procedure. It seems to work great. Thanks again.