5 Replies Latest reply on Nov 25, 2009 10:38 AM by SheiD

    Percent of a Field


      Hello all...


      I'm very lost trying to do what I thought was a simple calculation in Acrobat Pro 9.


      I have two rows of fields. Row A is the base value entered by the user. Row B will calculate based off of the values of Row A.


      For the purpose of explaining, I will call the Fields in Row A Field1a, Field2a, Field3a and the fields in Row B Field1b, Field2b and Field3b etc.


      The different fields in Row B use different calculations. For example, Field1b is equal to Field1a. Field 2b is equal to Field2a x 5. Field3b is equal to Field3a x .1

      This is where I'm having trouble.


      How do I set up calculations so that Field2b = (Field1a x 5) ?

      Or so that Field3b = (Field3a/10) ?


      on Field3b I tried:


      var c = this.getField(“Field3a”);

      event.value = c.value * 0.1;



      But it keeps saying there is an illegal character on line 2.


      Any help would be very appreciated.

        • 1. Re: Percent of a Field
          try67 MVP & Adobe Community Professional

          1. The problem is you're using non-standard quotes (you're probably using a non-English keyboard layout) in your first line.

          Try replacing that line with this one:

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


          2. You don't need JS for this. You can use the simplified annotaion script. Just write the field's name and the rest of the formula, like so:

          Field3a * 0.1

          1 person found this helpful
          • 2. Re: Percent of a Field
            SheiD Level 1

            Oh... duh. I'm sorry. I didn't know how to do the simple script either.


            I am not using a non-English keyboard. o_o so I have no idea why that happened with the quotations.


            As for the simple script, it isn't working.


            I entered the calculations like so:


            in Fieldb1, : Fielda1 * 5


            Fieldb1, : Fielda1 * 0.1


            And when I close form editing and enter a value into Fielda1, the field stays blank.

            I don't know what's wrong.



            Thank you for the help so far!

            • 3. Re: Percent of a Field
              try67 MVP & Adobe Community Professional

              Do you maybe have spaces in the names of your real fields?

              • 4. Re: Percent of a Field
                SheiD Level 1

                No, they are named : S.1 , S.2 , S.3 Etc


                Do I need to change the . part?

                • 5. Re: Percent of a Field
                  SheiD Level 1

                  I changed them to S1 S2 S3 etc and it is working now!


                  Excellent! Thank you so much for your help. I am sorry I am so dense at this.

                  You have really helped me today! Thank you!