Question
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
Virtusa
LK
Last activity: 24 Mar 2019 21:46 EDT
Restrict decimal Values
Hi,
I need to restrict the decimal values up to 5.The user must not type the decimal value more than 5 values.How to achieve this solution.
Thank You.
***Edited by Moderator Marissa to update platform capability tags***
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
![](https://accounts.pega.com/sites/default/files/pega-user-image/195/REG-194812.png?source=PUMINIT)
![](https://accounts.pega.com/sites/default/files/pega-user-image/195/REG-194812.png?source=PUMINIT)
Pegasystems Inc.
IN
Hi Jeevantha,
You can use the Decimal control for the property. There is a parameter tab that will help you define the number of decimal places that you want to set to restrict the end user.
Regards,
Evita.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
Virtusa
LK
Hi,
Is there a way to disable to type after the 5th decimal point
Thank You.
-
Feroz Khan
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
CollabPartnerz
IN
Can you try using decimal control ?
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
Virtusa
LK
Hi,
It doesn't stop from entering the value.Its truncating the additional decimal points.
Thank you.
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Aaseya IT Services Pvt Ltd
GB
Hi, Did you try creating custom edit-input rule.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/2023-03/c5d4771e-d600-496c-ac12-b258bdaccc68.jpeg?h=c4a72dc3&itok=YfGGERBa)
Virtusa
LK
Hi,
Will it stop the user typing.?
Can you please share a small example
Thank You
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
![](/profiles/pega_profile/modules/pega_user_image/assets/user-icon.png)
Pegasystems Inc.
IN
Hi Jeevantha
My Initial understanding is you want to display an error message when user enter more than 5 precision on decimal field. Error message should be displayed without submitting the form i.e. Client-Side Validation is required. Please see below URL and let me know if this will help.
https://community.pega.com/knowledgebase/articles/using-javascript-client-side-validation
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689877000/122ddbf9-8ed7-431e-8c0c-0892f658c39d.png?itok=HwmzfVHs)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689877000/122ddbf9-8ed7-431e-8c0c-0892f658c39d.png?itok=HwmzfVHs)
Pegasystems Inc.
US
Hi Jeevan,
Please find the below jquery code. It seems to be working at my end.
<script>
$('#NewProp').bind('keypress', function() {
var a = $("#NewProp").val();
if(a.length-a.indexOf('.')>5){
return false;
}
});
</script>
Basically, I have added an keypress event listener to a property( eg : NewProp). It should not allow user to enter after 5 decimal places.
Let me know in case you face any difficulty implementing this.
Regards,
Rachit
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/f7151e69-7bd9-4702-be03-ebb6f0beb05f.jpg?itok=GWX3Wdig)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689954000/f7151e69-7bd9-4702-be03-ebb6f0beb05f.jpg?itok=GWX3Wdig)
CollabPartnerz
IN
We have ootb control of Decimal.Please try with this.
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689976000/8eef63c0-0261-4538-b778-9a28bcc07550.png?itok=BqciCV0u)
![](https://accounts.pega.com/sites/default/files/styles/user_image/public/1689976000/8eef63c0-0261-4538-b778-9a28bcc07550.png?itok=BqciCV0u)
Goldman Sachs Group Inc
IN
Hi,
Thank you for posting this question.
Kindly follow the below steps to achieve your requirement.
1. Open the "UserWorkForm" and add the below script.
<script>
$('#DecimalProp2').on('input', function () {
this.value = this.value.match(/^\d+\.?\d{0,5}/);
});
</script>
Hi,
Thank you for posting this question.
Kindly follow the below steps to achieve your requirement.
1. Open the "UserWorkForm" and add the below script.
<script>
$('#DecimalProp2').on('input', function () {
this.value = this.value.match(/^\d+\.?\d{0,5}/);
});
</script>
2. In the place of "DecimalProp2" you should add the element id of your property. You can find that using browser debugger tool as below.
Thanks,
-
Bhaskar Gadapu Arvind Kumar Tripathi