Skip to main content
stepheng54012748
Known Participant
October 10, 2025
Answered

Acrobat Jave Script Question

  • October 10, 2025
  • 2 replies
  • 192 views

Good day to everyone!

 

I'm hoping someone can help me with a script so the result doesn't round up or down.  The issue is I am not using any decimal spaces so the result is rounding up.  Here is my example:  

 

field l6 = 101

field l9 = 200

field l10 = l6-l9 (this should give a result of (99) but it is rounding up to 100.  I suspect that field l6 is where the issue might be because the result of 101 (which is field M2 * .02).

 

Any ideas on script that might resolve this issue would be much appreciated.

 

    Correct answer try67

    Use this:

    event.value = Number(event.value).toFixed(2);

    This will round the field's value to two decimals. If you want a whole integer, change 2 to 0 in that code.

    2 replies

    try67
    Community Expert
    Community Expert
    October 10, 2025

    The value is probably something else than what you see. Click into the field to see the actual value.

    stepheng54012748
    Known Participant
    October 11, 2025

    I found where I can see the actual value.  Is it possible to write a validation script that narrows the value to number of decimals and takes the result from another field as the whole number?

    try67
    Community Expert
    try67Community ExpertCorrect answer
    Community Expert
    October 11, 2025

    Use this:

    event.value = Number(event.value).toFixed(2);

    This will round the field's value to two decimals. If you want a whole integer, change 2 to 0 in that code.

    Nesa Nurani
    Community Expert
    Community Expert
    October 10, 2025

    Can you share file?