Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

Focus shifts to error table during any action in repeating grid

SA-50183

Summary



Focus shifts to the error table when performing any action in a repeating grid. This occurs when validation error messages are present for the repeating grid.


Error Messages



Not Applicable.


Steps to Reproduce

  1. Create a repeating grid with a page list as the data source
  2. Run the flow
  3. Click the 'Delete Item' icon at run time, when there are errors on the harness. The action is not performed and the focus shifts to the error table


Root Cause



In the pega.u.d.defaultErrorDivInit API, a check for accessibility of the error table is missing. Hence, the focus shifts to the error table on submitting a task.


Resolution

Perform the following local-change:

Add a check for accessibility in the pega.u.d.defaultErrorDivInit API
Modify the API in UserWorkForm as below:

<script>
$(document).ready(function(){
if(pega && pega.u && pega.u.d){

pega.u.d.defaultErrorDivInit : function (errorText) {
var errorDiv = document.createElement("DIV");
errorDiv.innerHTML = errorText;
var errorDiv2 = document.createElement("DIV");
errorDiv2.innerHTML = errorText;

// check the existancy of ERRORTABLE
var errorTables = pega.util.Dom.getElementsById("ERRORTABLE", document);
if (errorTables) {
// Set the error messages to the existing ERRORTABLE

for (var t = 0; t < errorTables.length; t++) {
pega.util.Dom.setStyle(errorTables[t], "display", "block");
var errorSpan = pega.util.Dom.getElementsById("ERRORMESSAGES_ALL", errorTables[t]);
if (errorSpan && errorSpan.length > 0) {
var msgSpan = pega.util.Dom.getElementsById("ERRORMESSAGES_ALL", errorDiv);
if (msgSpan && msgSpan.length > 0) {
errorSpan[0].innerHTML = msgSpan[0].innerHTML;
} else {
errorSpan[0].innerHTML = errorText;

}
}
}
}

// Check the existancy of PEGA_HARNESS div tag
else if (document.getElementById("PEGA_HARNESS") != null) {
// Set the error messages as the first element to the RULE_KEY div tag
document.getElementById("PEGA_HARNESS").insertBefore(errorDiv, document.getElementById("PEGA_HARNESS").firstChild);
if (pega.u.d.formErrorType != "FLOAT") {
document.getElementById("PEGA_HARNESS").appendChild(errorDiv2);
}
var errorTables = pega.util.Dom.getElementsById("ERRORTABLE", document);
if (errorTables) {
for (var t = 0; t < errorTables.length; t++) {
pega.util.Dom.setStyle(errorTables[t], "display", "block");
}
}
}
//Attaching error div to div with id 'FormErrorMarker_div
else if (document.getElementById('FormErrorMarker_Div')) {
formErrorMarkerdiv = document.getElementById('FormErrorMarker_Div');
formErrorMarkerdiv.insertBefore(errorDiv, formErrorMarkerdiv.firstChild);
formErrorMarkerdiv.style.display = "block";
document.getElementById("ERRORTABLE").style.display = "block";
}
// No ERRORTABLE or RULE_KEY
else if (document.getElementsByTagName("DIV")[0] != null) {
// Set the error messages to the first div element of the document
document.getElementsByTagName("DIV")[0].insertBefore(errorDiv, document.getElementsByTagName("DIV")[0].firstChild);
document.getElementsByTagName("DIV")[0].style.display = "block";
document.getElementById("ERRORTABLE").style.display = "block";
}
/*(accessibility story) focus on error table start*/
if(pega.u.d.isAccessible){

var accessErrorTable=document.getElementById("ERRORTABLE");
if(!pega.u.d.bModalDialogOpen && accessErrorTable && accessErrorTable.getAttribute("role")=="alert"){
/*BUG-162342: Adding try-catch below*/
try {
accessErrorTable.focus();
}
catch(e){}
}
}
/*(accessibility story) end*/
},


}
});

</script>



Suggest Edit

Published March 30, 2018 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

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

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us