Support Article

Date Field label doesn't change style on error

SA-37386

Summary



The style applied for Error label is not applied to Date Field Label with Pega 7.1.6.


Error Messages



Not Applicable


Steps to Reproduce



1.Set style and required colour for the error Label in Skin rule.
2.Verify if the style is applied to the label in error scenario.


Root Cause



A defect in Pegasystems’ code or rules.

Resolution



Paste below code in USERWORKFORM:

<script>
function findLabelFor(errorElement) {
var errorElemParent = errorElement.parentNode;

var parentTable = errorElement;
while ((parentTable != null) && ((parentTable.tagName != "TABLE") || (parentTable.className.indexOf("textAreaExpandStyle") > -1))) {
parentTable = parentTable.parentNode;
}


if (errorElement.className == "Radio" || errorElement.className == "autocomplete_input") {
var parentTable = parentTable.parentNode;
while ((parentTable != null) && (parentTable.tagName != "TABLE")) {
parentTable = parentTable.parentNode;
}
}

if (!parentTable)
return "";


var labelList = parentTable.getElementsByTagName("LABEL");

var labelForElement = null;


var elemId = errorElement.id;
if (elemId == "EXPAND" && errorElement.tagName.toLowerCase() == "textarea" && errorElement.DisplayedProperty) elemId = errorElement.DisplayedProperty;
for (var el = 0; el < labelList.length; el++) {
labelList[el].htmlFor = labelList[el].htmlFor.substring(labelList[el].htmlFor.indexOf(".") + 1);
if ((labelList[el].htmlFor.toLowerCase() == elemId.toLowerCase()) && (labelList[el].innerText != "")) {
labelForElement = labelList[el];
break;
}
}

return labelForElement;
}
</script>


Published May 3, 2017 - Updated May 16, 2017

Have a question? Get answers now.

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