Skip to main content
Participant
August 11, 2024
Question

Errors when rounding, and formatting as Number (Money) when values exceed certain threshold.

  • August 11, 2024
  • 1 reply
  • 225 views

I am running a form with several calculations. 

I have most if not all fields formatted to number, comma separator, $ symbol etc. 

I have also added "event.value = util.printf("%,0.2f",event.value);" to round properly. 

When the value of any field with "event.value = util.printf("%,0.2f",event.value);" is 1000 or above, I get the error:  "The Value entered does not match the format of the field."

 

Is there any way around this error?

This topic has been closed for replies.

1 reply

PDF Automation Station
Community Expert
Community Expert
August 12, 2024

util.printf creates a text string with certain characteristics.  Forcing a text string with a comma into a field formatted as number is why you are getting the error.  What do you mean by "round properly"?  Do you want the number to round to 2 decimal places?  If so, use this script instead:

event.value=Math.round(event.value*100)/100;