2 Replies Latest reply: Feb 7, 2012 7:50 AM by Peter_Chiodo RSS

    Adding a formula to form with acrobat professional

      I am new to this so please be nice. My boss handed me the program last week and I have been creating a form (to the best of my abilities). I need to know how to insert a formula into a field so that it automatically calculates the total.

      This is my formula (per excel format)
      =(box1*32.9+box2*67+box3*75.8)*0.9

      Is there a place in the object palette where I should be putting this in?
      What all should be checked and entered in order for this to automatically calculate the total for the above equation?

      Thanks so much!
        • 1. Re: Adding a formula to form with acrobat professional
          George_Johnson CommunityMVP
          What you need to do is set up a calculated field. You do this by adding JavaScript code to the field's Calculate event. Exactly how you do this depends on which version of Acrobat you're using, but the code might look something like:


          (function() {

             // Get the field values, as numbers
             var v1 = +getField("box1").value;
             var v2 = +getField("box2").value;
             var v3 = +getField("box3").value;

             // Perform the calculation
             var result = 0.9 * (v1 * 32.9 + v2 * 67 + v3 * 75.8);

             // Set the value of this field to the result
             event.value = result;
          })();


          You would replace "box1", "box2", and "box3" above with the actual names of the fields you're using. The code could be simplified a bit, but this should get you started. Also, make the calculated field read-only.

          George
          • 2. Re: Adding a formula to form with acrobat professional
            Peter_Chiodo

            thanks alot for this, helped me alot! George you are a Legend!