Skip navigation
Currently Being Moderated

Adding a formula to form with acrobat professional

Jan 16, 2009 7:08 AM

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!
 
Replies
  • George Johnson
    11,664 posts
    Aug 11, 2002
    Currently Being Moderated
    Jan 16, 2009 10:36 AM   in reply to (misty_tanner)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2012 7:50 AM   in reply to George Johnson

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

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)