Print Page | Close Window

Whole number without rounding...

Printed From: Foxit's Planet PDF Forum
Category: Lets Talk PDF
Forum Name: JavaScript
Forum Description: Discussions relating to the use of JavaScript within PDF.
Printed Date: 17 Feb 2020 at 8:26pm
Software Version: Web Wiz Forums 11.10 -

Topic: Whole number without rounding...
Posted By: RaeEveMay
Subject: Whole number without rounding...
Date Posted: 28 Jan 2015 at 8:20pm
I need to get the value of a field "LOAN_AMT" that is a numeric field with two decimals and convert that into a new field "LOAN_AMT_NO_CENTS" that does not round. This is the problem I am having:

LOAN_AMT_NO_CENTS pulls in 16 instead of 15. 

I basically just need to truncate the cents off of the amount.

I know this does not make sense most forms would require you to show 16 in the example above but that's the Federal Government for you! These new forms are a nightmare!

Any advice is greatly appreciated.

Thank you,


Posted By: try67
Date Posted: 28 Jan 2015 at 11:31pm
Use this code as the custom calculation script of LOAN_AMT_NO_CENTS:
event.value = Math.floor(+this.getField("LOAN_AMT").value);

- Acrobat Expert - Contact me personally at
Check out my custom-made scripts website:

Posted By: RaeEveMay
Date Posted: 29 Jan 2015 at 7:09pm
Thank you! That worked like a charm! 

Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.10 -
Copyright ©2001-2017 Web Wiz Ltd. -