4 Replies Latest reply on Nov 21, 2017 12:07 PM by Thom Parker

    need java script help for auto populating forms


      created a shipping form with drop down box of ship to names but want to auto populate the facility name, address, phone etc based on whose name i select.. looked at alot of the info on java scripting this and just still confused,, can some one really spell it out and make it simple. i cannot load additional sofware due to system being admin locked down so have to work within adobe acrobat.. thanks

        • 2. Re: need java script help for auto populating forms
          DimitriM Level 3

          This tutorial should be helpful-





          Hope this helps,




          • 3. Re: need java script help for auto populating forms
            jamesw1957 Level 1

            Thanks DimitriM,,, trying what you provided and some makes sense... changed the fieldname but still no go.. will keep working on it i don't like loosing!!

            • 4. Re: need java script help for auto populating forms
              Thom Parker Adobe Community Professional

              James, you have a slightly complicated request, and so the code is going to be slightly complicated and you'll need to learn a bit about scripting to make this work. The important bits are really in the fine details such as matching braces, brackets, and parentheses. Getting the location of semi colons correct, and stuff like this.  It can be a pain, So you should approach it one piece at a time.


              The Article Dimitri pointed out is exactly what you need. I mean exactly. It provides the exact action you described.  Selecting an option from a drop down, which then populates a set of fields. Making the name and data changes without messing up the code syntax/formatting is the key to success.


              Here's a short explanation to give you a high level view of where you are going.  There are really two separate pieces to the solution. The first piece is the data set. For each entry in the drop down there is an associated set of data for filling in the fields. In the article the data is organized as an object, where each named entry matches an entry in the drop down.  Entries that include spaces must be enclosed in Quotes. This bit messes up a lot of people. 


              The second bit is the event function that selects the correct data and fills in the other fields. In the article this is written as an external function to make it more generic, but it doesn't have to be. You can put the meat of the code right into the "Keystroke" script for the field.

              The only important bit is that it selects the data and writes it to the correct fields.




                   this.getField("Name") = DeptData[event.value].Name;

                   this.getField("Address") = DeptData[event.value].Address;