How to calculate the sum of several cells in fillable form?

Question

How to calculate the sum of several cells in fillable form?

Answer

To calculate the sum of several numbers in the fillable form follow the steps below:

  1. Open the file in PDF Editor.
  2. Create a fillable form or click on Form Editor tab in the menu bar.
  3. Add the button for the calculation of the sum:

For example:

  • Trigger event can be set as Click;
  • Action as Run JavaScript;
  • In the field for the script, the following action can be used:
getField("TextField 3").value = getField("TextField 1").value + getField("TextField 2").value

4. Enter the script, click Save, and then Ok.

5. Go back to the Document tab.

6. Click the Sum button to receive the sum number.

Have more questions? Submit a request

Comments

2 comments

  • Avatar

    Fram Lorbin

    When will you make javascript available in the Text Field Wizard and not just tied to the button Wizard?

    That way we can dispaly the result without needing to click the button first.
    Keep in mind forms with 100's of calculations cases makes using buttons most cumbersome.

    Here's the Adobe Acrobat way to do it:
    https://youtu.be/xQu3iY9IzDM?t=165 

    var w10 = this.getField("0011").value;
    var w11 = this.getField("0012").value;
    var w12 = this.getField("0013").value;
    var w13 = this.getField("0014").value;
    var w14 = this.getField("0015").value;

    if (w10 == "") w10 = 0;
    if (w11 == "") w11 = 0;
    if (w12 == "") w12 = 0;
    if (w13 == "") w13 = 0;
    if (w14 == "") w14 = 0;

    if (w10 == 0 && w11 == 0 &&  w12 == 0 &&  w13 == 0 && w14 == 0)
    event.value = "";
    else if (w10 + w11 + w12 + w13 + w14 != 0)
    event.value = w10 + w11 + w12 + w13 + w14;


    Your form Editor in much better to build PDF forms templates than Adobe Acrobat but for the lack of Text Field javascript functonality.

    0
  • Avatar

    Fram Lorbin

    Same concept with PDFElement
    https://youtu.be/1qGllpeqHXs?t=54 

    0

Please sign in to leave a comment.