Support Article
Invalid error message gets cleared on performing tab-out twice
SA-40159
Summary
For integer/decimal properties, when a value is specified in Min characters under Cell Properties > EDITABLE SETTINGS > Min/Max chars, the invalid validation error message gets cleared/removed if user places the cursor on the field for second time and performs Tab-Out from the input field (without altering the invalid input).
Error Messages
Not Applicable
Steps to Reproduce
1. Create a section rule.
2. Drag and drop a text Input control.
3. Map an integer property to the Text Input control.
4. Under Cell Properties > EDITABLE SETTINGS > Min/Max chars, specify a value in Min/Max fields.
5. Configure an On change-Post Value event on this field.
6. Enter an invalid text to get a validation message. Tab out and tab-in twice.
Root Cause
A defect in Pegasystems’ code or rules:
Validation message is cleared with min-max char used with post value, Onblur event is not present on Integer for min-max validation.
Resolution
Perform the following local-change steps:
1.Include the below snippet in userworkform:
<script>
setTimeout(function(){
var numeric_integer = new validation_ValidationType("integer", numeric_isInteger);
numeric_integer.addEventFunction("onchange", numeric_isInteger);
numeric_integer.addEventFunction("onblur", numeric_isInteger);
function numeric_isInteger(object){
//var x = removeCommas(object.value);
var x = removeSeparator(pega.control.PlaceHolder.getValue(object), grouping_separator);
if(null == x || "" == x)
{
return;
}
// Regular expression for integers
// The value can have '-' item 0 or 1 time ((\-)?) and any number of digits afterwards (d+)
var reInteger = /^(\-)?\d+$/;
var legalInteger = x.match(reInteger);
if(legalInteger == null){
return display_getValidationError(object, "", numeric_integerMsgStr);
}
//If the integer should be reformatted, enable the following line
//object.value = numeric_reformat(x);
}
},500);
</script>
2. Remove minimum characters configuration from control and do the same validation at server.
3. Move the integer field to a section and configure on change > refresh section with some pre activity, in the pre-activity do the necessary validations.
Published December 5, 2017 - 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.