Question
Numeric field allowing non-numeric characters (E, e, +, -)
I have an integer property in a section for which I use the "numeric" editable format to restrict the user to be able to enter only numerical characters.
From the other articles of the PEGA community, I understood that there are currently the 2 following issues:
1) This format allows the user to enter also the following characters: +, -, E, e (exponent)
2) If the property value contains "e" or "E", it is emptied when tabbing out the field or submitting the form (Browser issue), which means that :
2a) the required fields will display the error message "Cannot be blank"
2b) custom validation (to display an error message like "Numeric fields cannot contain letters") won't work because it will check an empty property!
Therefore, what is the solution?
a) Ideal solution: Is it possible to update the numeric editable format to allows only digits and not +, -, E, e ?
b) Work around: how to avoid the browser to empty the field?
***Edited by Moderator: Lochan to update platform capability tags***
Hi Ridwan,
The root cause of this behavior is not a Pega defect, but rather browser behavior exacerbated by an inconsistency with how browsers are interpreting the current HTML5 number input type standard.
In Chrome user is allowed to type 'E' and the + or - sign. All other characters are not allowed to even be typed in the field.In IE 11, user can type anything into a number input field. But upon tab out or blur the browser will wipe out the field if it is not a valid number.In Chrome it does not nullify the input field until one actually submits the form.So in both cases, the reason why user is able to submit the form is because the edit-validate rules were not even invoked, and also because there were no values to even validate.The browser itself wiped the values before Pega has a chance to perform any actions.
Please refer the following link for more information:
https://community1.pega.com/community/pega-product-support/question/number-presentation-format-accepts-character-ee
Thanks,
Rakshith.