1 Reply Latest reply on Jan 25, 2017 11:44 AM by matf88679416

    JavaScript Question

    matf88679416

      Hi,

       

      I am trying to make a PDF - I want one section to autofill using a java script.

       

      I have 4 names in a drop down field called: "Site Contact"

      I would like another field to auto populate a phone number - for instance:

       

      If "Joe" then "1-800-555-5555"

      And an option that if there is no name selected then it is blank.

       

      Can i do this?

       

      Thanks,

       

      [ Mod: Changed subject form "Java" to "JavaScript" Question - this has nothing to do with Java ]

        • 1. Re: Java Question
          try67 MVP & Adobe Community Professional

          As the custom calculation script of the phone field you can use something like this:

           

          var name = this.getField("Site Contact").valueAsString;
          if (name=="") event.value = "";
          else if (name=="Joe") event.value = "1-800-555-5555";
          else if (name=="Mary") event.value = "1-800-555-5556"; // etc.