Question
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!
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.
Virtusa
LK
Hi,
Is there a way to disable to type after the 5th decimal point
Thank You.
-
Feroz Khan
CollabPartnerz
IN
Can you try using decimal control ?
Virtusa
LK
Hi,
It doesn't stop from entering the value.Its truncating the additional decimal points.
Thank you.
Aaseya IT Services Pvt Ltd
GB
Hi, Did you try creating custom edit-input rule.
Virtusa
LK
Hi,
Will it stop the user typing.?
Can you please share a small example
Thank You
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
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
CollabPartnerz
IN
We have ootb control of Decimal.Please try with this.
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