2 Replies Latest reply on Feb 1, 2017 11:01 AM by RayKIII

    Auto Fill two fields depending on text in another field

    RayKIII

      Working with Adobe Acrobat Pro DC

       

      I am trying to fill two other text fields with different information depending on what is entered into a third text field.  Here is the script I put together, but it is not working.  I have tried to set it to Select Trigger: Mouse Up and Mouse Enter also.  Any suggestions?

       

      var v = event.target.value;

      var f4 = this.getField("Days available");

      var f5 = this.getField("Pay Level");

      if (v != "1") {

          f4.value = "3";

        f5.value = "1";

         

      }

      else if (v != "2") {

          f4.value = "4";

        f5.value = "1";

         

      }

      else if (v != "3") {

          f4.value = "5";

        f5.value = "2";

         

      }

      else if (v != "4") {

          f4.value = "6";

        f5.value = "3";

        • 1. Re: Auto Fill two fields depending on text in another field
          gkaiseril MVP & Adobe Community Professional

          What exactly is happening when you enter a value?

           

          Did you check the Acrobat JavaScript console for any errors?

           

          What do you want to happen if none of the expected values is entered?

           

          I would consider using the equality operator and not the no equal operator.

          • 2. Re: Auto Fill two fields depending on text in another field
            RayKIII Level 1

            Sorry, I am very new to writing scripts.  As soon as I select the text field it puts 3 and 1 in the other fields.  If I enter another number then nothing happens.

             

            Where do I find the JavaScript console?

             

            Sorry I had added the following at the end for when there was something else put in the field and forgot to put that in original post.

            else {

                f4.value = "0";

              f5.value = "0";

              

            }

             

            Thank you for pointing out the no equal operator.  That appears to have been my problem, thank you very much for your help for such a silly problem.