Skip to main content
Participant
Jan 29, 2025 1:11 AM UTC
Answered

Interactive PDF calculation fields do not update correctly

I have created a PDF that needs to carry out several simple calculations. These calculations are partly dependent on each other, e.g. a+b=c x+y=z then c+z=Total. Now I have the problem that the fields don't always update correctly. Does anyone have a solution for this problem?

    Nesa Nurani
    Nesa NuraniCorrect answer
    Community Expert
    Jan 29, 2025 5:21 AM UTC

    The problem is in 'Field calculation order', make sure the fields that should calculate first are on top.

     

    To change field calculation order in old acrobat:
    Select 'Prepare form' tool, click 'More' then 'Set field calculation order'.

    In new Acrobat:
    Select 'Prepare form' tool, click on the 3 dots (the ones where say 'fields') and select 'Set field calculation order'.

    5 replies

    boilermaker73
    Inspiring
    Nov 1, 2026 2:04 PM UTC

    An Alternative to Acrobat's Automatic Field Calculation Order

    Although this discussion is approximately one year old, I'd like to share an alternative approach based on my 30 years of experience designing and developing JavaScript-enhanced interactive PDF forms.

    While adjusting Acrobat's field calculation order is an appropriate solution, I've also used document-level JavaScript functions triggered by field events to control dependent calculations explicitly, rather than relying exclusively on Acrobat's automatic calculation sequence.

    For example, suppose a form contains four input fields (a, b, x, and y) and three calculated results:

    • c = a + b

    • z = x + y

    • Total = c + z

    The following document-level function updates the three results in the required order:

    function updateTotals(changedField, newValue) {
    var names = ["a", "b", "x", "y"];
    var values = {};
    var f, i, n;

    for (i = 0; i < names.length; i++) {
    f = this.getField(names[i]);
    n = Number(names[i] === changedField
    ? newValue
    : (f ? f.value : 0));
    values[names[i]] = isFinite(n) ? n : 0;
    }

    var c = values.a + values.b;
    var z = values.x + values.y;

    this.getField("c").value = c;
    this.getField("z").value = z;
    this.getField("Total").value = c + z;
    }

    Then, in the Validate event of each of the four input fields, use:

    if (event.rc) {
    updateTotals(event.target.name, event.value);
    }

    This example assumes numeric input values, treating blank or invalid numeric values as zero. The result fields should not also contain competing automatic calculation scripts.

    Alternatively, a document-level function can be called from an On Blur event to perform the same calculations using the committed field values.

    The advantage of this approach is that the calculation sequence is explicitly controlled by the function. The dependent results are updated in the intended order rather than relying on Acrobat's automatic field calculation order.

    This technique doesn't replace Acrobat's built-in calculation functionality, which works well in many situations. It simply provides another option when developing interactive PDF forms containing multiple interdependent calculations.

     

    Translate
    Nesa Nurani
    Community Expert
    Nesa NuraniCommunity ExpertCorrect answer
    Community Expert
    Jan 29, 2025 5:21 AM UTC

    The problem is in 'Field calculation order', make sure the fields that should calculate first are on top.

     

    To change field calculation order in old acrobat:
    Select 'Prepare form' tool, click 'More' then 'Set field calculation order'.

    In new Acrobat:
    Select 'Prepare form' tool, click on the 3 dots (the ones where say 'fields') and select 'Set field calculation order'.

    Translate
    Participant
    Jan 29, 2025 8:00 AM UTC

    Hello
    Yes this was the issue many thanks for the swift help.

    Translate
    John T Smith
    Community Expert
    Community Expert
    Jan 29, 2025 1:37 AM UTC

    You need to ask program questions in the forum for the program you are using
    To ask in the forum for your program please start at https://community.adobe.com/
    Moving from Using the Community (which is about the forums) to the Acrobat forum

    Translate
    SBH_2
    Participant
    Feb 6, 2026 7:14 AM UTC

    This probably doesn’t belong in this area either, but . . . the REAL problem is the Adobe “help” resource is not organized in a very helpful manner - it is very difficult (for me, at least) to determine where I out to look for the answer to most anything.  I pose the question at the top of the “overall” help section that has the overly large icons for each of the products (too much marketing, not enough help) - it generally returns a link to a similar or virtually identical question and response - I click on the link and wind-up at the top of a LONG list of questions all over the board that must be scrolled thru (sometimes seemingly endlessly) until i get to the response that was initially linked.  When I click on the link, it should take me to THAT link.  

    Translate