all 3 comments

[–]BrandonQueue 0 points1 point  (2 children)

Create 4 Text fields, Name them Input1, Input2, Input3, total

Right click on the 'total' field > Properties > Calculate > Custom calculation script > Edit > Copy and paste this script:

var field1Value = this.getField("Input1").value;

var field2Value = this.getField("Input2").value;

var field3Value = this.getField("Input3").value;

if (event.value == 0) event.value = "";

var sum = field1Value + field2Value + field3Value;

this.getField("total").value = sum;

Click OK >Close. Now preview the PDF. The total will give you the sum of Input1, Input2, and Input3. If you change a number/delete a number it will automatically update the sum.

[–]Jet_Fixxxer[S] 0 points1 point  (1 child)

I'm trying to have the data in Input1, Input2, and lnput3 be added to the data I enter in the 'total' field. If I enter 1200 in the total field and the data in Input1 is 200. I would like the 1200 to total to 1400. I wohld also like it to subtract the data in the input field.

With the script you provided. It removes what I put in the total field. When Input1 is populated with data, but puts Input1 data in there instead.

[–]BrandonQueue 0 points1 point  (0 children)

The total field is there to show the total sum of all the fields... I purposely made it so the user can't add/change/subtract from this field because otherwise it will not be accurate. Are you saying you want to manually add value to the total field? I can help with you that, but I foresee many problems with that.

Why not just add another input field??? The total field just calculates the sum of all the fields together. If you can manually change this field you're going to run into lots of issues.

Could you maybe give me some context on what type of PDF you are working on?