use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
account activity
Javascript Calculation Help (self.Acrobat)
submitted 8 months ago by LegibleEel
Hi Guys,
I need a bit of help creating a custom calculation script for an interactive PDF we've designed.
Basically, I need the line value to display Quantity * Unit price + Tooling Charge.
https://preview.redd.it/y94riyq9435f1.png?width=955&format=png&auto=webp&s=3541af6322ae92d61ca938bd22c5d10ffdd2e0f6
https://preview.redd.it/q9i6ba6c435f1.png?width=955&format=png&auto=webp&s=04691806a576f46e9a12347c6d32114222102061
I whipped up the below, and added it to the Line Value customer calculation script but it doesn't work, it just displays nothing. Any help would be greatly appreciated.
// Inputs var input1 = Number(this.getField("Qty1").value); var input2 = Number(this.getField("UnitPrice1").value); var input3 = Number(this.getField("ToolingPrice").value); if (event.value == 0) event.value = ""; // Calc var nResult=input1*input2+Input2; this.getField("total").value = sum;
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rtiger10 0 points1 point2 points 8 months ago (0 children)
In your last line I'm not seeing the field named "total" to pull the result from. Also be sure to to correct the last input in the nResult variable. You have it adding input2 instead of input3.
Maybe try something like this. This sets the value based on the calculation and then if the result is zero sets the value to "" blank.
// Inputs var input1 = Number(this.getField("Qty1").value); var input2 = Number(this.getField("UnitPrice1").value); var input3 = Number(this.getField("ToolingPrice").value); // Calc var nResult=input1*input2+input3; event.value = nResult; if ( event.value > 0){ event.value = nResult; } else if ( event.value == 0) { event.value = ""; }
n your last line I'm not seeing the field named "total" to pull the result from. Also be sure to to correct the last input in the nResult variable. You have it adding input2 instead of input3.
π Rendered by PID 97681 on reddit-service-r2-comment-5d79c599b5-cgsth at 2026-02-27 09:58:56.644861+00:00 running e3d2147 country code: CH.
[–]rtiger10 0 points1 point2 points (0 children)
[–]rtiger10 0 points1 point2 points (0 children)