Support Article

Accessibility: Required when messages are not displayed

SA-32956

Summary



For accessibility users, error messages are not displayed when the fields are only mandatory for some conditions.


Error Messages



It just shows the dialog box with a message "There were some errors on the page", but it doesn't highlight the field the error occurred.


Steps to Reproduce



1. In a section, there is a field where the condition When is selected.
2. Login as an accessible user.
3. Traverse to that screen and check if the field is highlighted and the error message is displayed when the conditions satisfy and the field is empty.


Root Cause



A defect in Pegasystems’ code or rules.

When Pega web Accessibility is enabled, Client side validation error messages are getting triggered on modal dialog.

Resolution



Include the below script in "userworkform":


<script type="text/javascript">
(function() {
varcustomValidation_displayFieldError = function(errorList, successList, event){
event = event == undefined?window.event : event;
varerrorString = "";
if(0 < errorList.length){
for(vari=0; i<errorList.length; i++){
errorString += errorList[i].errorMessage + "\n";
insertErrorElement(errorList[i]);
}
if((gErrorElementName==pega.util.Event.getTarget(event).name) || (gErrorElementName=="")){
gErrorElementName = pega.util.Event.getTarget(event).name;
if(gErrorElementName!=""){
if(!confirm(errorString)){
gErrorElementName = "";
return;
}
}

varfirstElementName = errorList[errorList.length-1].element.name;
window.setTimeout("pega.u.d.Axisbility.focusElement('" + firstElementName +"')", 100);
}
}
else{
gErrorElementName = "";
}
},
insertErrorElement = function(error) {
debugger;
$(".inputError").remove();

varerrMsgEl = document.createElement('SPAN');
errMsgEl.setAttribute("id", "PegaRULESErrorFlag");
errMsgEl.className = "inputError";
errMsgEl.setAttribute("title", error.errorMessage);
errMsgEl.innerHTML = "Error: " + error.errorMessage;
error.element.parentNode.insertBefore(errMsgEl, error.element);

};
pega.u.d.attachOnload(function() {
window.validation_displayFieldError = customValidation_displayFieldError;
},false);
})();
</script>

Published January 27, 2017 - Updated February 7, 2017

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.