Skip to main content
Known Participant
May 12, 2017
Question

Populate Two TextFields based on DropDownList selection

  • May 12, 2017
  • 1 reply
  • 336 views

hi, in my form Drop Down List available 50 items. i have found bellow code so as per bellow code i have to make 50 cases. updating 50 cases will take lot of time. is there any other code available that i can easily copy paste all the details??. i mean first i will copy all drop down options & then corresponding auto population options. thanks..

     var sNewSel = event.value;
     switch (sNewSel) {
       case "ProductNo1":
         this.getField("ItemDescription").value = "blah, blah";
         this.getField("Size").value = "blah, blah";
         break;

     case "ProductNo2":
         this.getField("ItemDescription").value = "blah, blah";
         this.getField("Size").value = "blah, blah";
         break;

     case "ProductNo3":
        this.getField("ItemDescription").value = "blah, blah";
        this.getField("Size").value = "blah, blah";
         break;

     //etc.
     }

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
May 12, 2017

You can use a literal object or an array to hold the data and then read it from there, but if you don't want to hard-code the data into your script (which I think is much preferable) then you could use a tab-delimited text file, attached to the PDF, where the data will be located, and a script to read it each time the file is opened. That way, you could just edit the text file directly (by opening it and modifying it, or even by replacing it completely with a new file), and the fields will reflect it.

You can use this tool I've developed to achieve that: Custom-made Adobe Scripts: Acrobat -- Populate Fields From Dropdown