• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

New Here ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

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?

TOPICS
JavaScript , PDF forms

Views

54

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 11, 2024 Aug 11, 2024

Copy link to clipboard

Copied

LATEST

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;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines