Join us Dec. 16 for The Community Hour, our first global virtual User Group event!

How to Limit the Number of decimal places to "two" for money field

lakshman nalla
Tera Contributor

hi 

 

i have a requirement, we have a field that field's value is auto populating we have to set limit to two decimal places to that value. please suggest.

 

 

thanks 

lakshman

1 ACCEPTED SOLUTION

Mohan Mallapu
Kilo Sage

Hi @lakshman nalla ,

What i understand based on your requirement, If the value of the field is 10.12455  and the expected output is 10.12

If the field value is auto-populating from the Client script or BR, You can restrict the value limit by using the toFixed() Javascript method.
var num = 10.1234;
var n = num.toFixed(2);

Output: 10.12
Referral Link : https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_tofixed 


Please mark my answer as helpful and the solution accepted if it serves the purpose.


 

View solution in original post

3 REPLIES 3

Mohan Mallapu
Kilo Sage

Hi @lakshman nalla ,

What i understand based on your requirement, If the value of the field is 10.12455  and the expected output is 10.12

If the field value is auto-populating from the Client script or BR, You can restrict the value limit by using the toFixed() Javascript method.
var num = 10.1234;
var n = num.toFixed(2);

Output: 10.12
Referral Link : https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_tofixed 


Please mark my answer as helpful and the solution accepted if it serves the purpose.


 

Mike Adams1
Tera Contributor

This doesn't work