Support Article
pyDecimalPrecision Qualifier applied on Property not working
SA-76303
Summary
Decimal type property is configured such that the qualifier for pyDecimalPrecision = 2.
On inputting a decimal value, the value is rounded off to two decimal places after a Save or a Submit. However, the qualifier does not restrict the user to input only two decimal places.
Error Messages
Not Applicable
Steps to Reproduce
- Create a decimal type property.
- Set the qualifier for pyDecimalPrecision = 2
- Enter a decimal value with more than two decimal places for the property.
Root Cause
This behavior is as per Pega product design.
The functionality of the pyDecimalPrecision qualifier is to round off the decimal value to the set number of decimal places. The qualifier is not designed to restrict the input which is not according to the number of set decimal places.
Resolution
Perform the following local-change:
- Add the below script in the UserWorkForm.
<script>
$('#DecimalProp2').on('input', function () {
this.value = this.value.match(/^\d+\.?\d{0,2}/);
});
</script>
- Add the element ID of the property instead of DecimalProp2.
Published April 5, 2019 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.