Skip to main content
Known Participant
September 1, 2023
Question

Unwanted Zeros Appears in Calculated Field Text Boxes

  • September 1, 2023
  • 1 reply
  • 4707 views

Hello,

I am preparing a form for our shipping department and I have it set up to calculate taxes, palletizing, etc and give a total.  At first, it was giving me numbers with a bunch of decimal places like $37.555555557778 so I set the format to number and 2 decimals.  It also makes an unwanted zero appear in that space even though no data has been entered yet.  How can I fix this?  I want my calculations to remain the same and for the numbers to only display 2 decimal places but I don't want the zero there because we sometimes have to fill out the form manually.  I have very little experience with java script, I read up on some things but they do not make any sense to me.  If there is a flat out formula you know that I can just copy and paste to the custom format box that achieves this, please just let me know.  I greatly appreciate any help and thank you for your time.  If this post is duplicated, I apologize, I think I posted it in the wrong area.

1 reply

Nesa Nurani
Community Expert
Community Expert
September 1, 2023

As 'Validate' script of those fields, use this:

if(event.value == 0)event.value = "";
johnsboxAuthor
Known Participant
September 1, 2023

Do I go to the validate tab and run custom validation script?

Nesa Nurani
Community Expert
Community Expert
September 1, 2023

Yes.