Support Article
Incorrect property highlighted on section reuse
SA-75415
Summary
A section is reused in multiple nested locations and the ID is set as the required property.
When an error occurs on any of the nested ID property fields, the system marks the incorrect loaded page ID property field in red.
Error Messages
Not Applicable
Steps to Reproduce
- Create a section with two fields.
- Mark both fields as mandatory.
- Add them to the process.
- Populate just one of the fields..
Root Cause
A defect in Pegasystems’ code or rules.
Resolution
Perform the following local-change:
Use the UserWorkForm to override the JavaScript function to manage the Validation process to include the content as below: <script>
function findLabelFor(errorElement) {
var errorElemParent = errorElement.parentNode;
var isRadioCtrl = false;
var isRadioAG = false;
if (errorElement.className == "Radio") {
isRadioCtrl = true;
}
var parentTable = errorElement;
while ((parentTable != null) && ((parentTable.tagName != "TABLE") || (parentTable.className.indexOf("textAreaExpandStyle") > -1))) {
/* BUG-195268: Checking for Auto Generated Radio button(check for class name "radioTable") */
if (isRadioCtrl && !isRadioAG && parentTable.tagName &&
parentTable.tagName.toLowerCase() == "div" && pega.util.Dom.hasClass(parentTable, "radioTable") > -1) {
if (parentTable.getAttribute("data-ctl") == "RadioGroup") {
isRadioAG = true;
}
}
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 labelForElement = null;
var elemId = errorElement.id;
/* BUG-195268: START */
if (isRadioAG && elemId.lastIndexOf(errorElement.value) > 0) {
/* radio input id = field label id + input element value */
try {
elemId = elemId.substr(0, elemId.lastIndexOf(errorElement.value));
} catch (e) {}
}
/* BUG-195268: END */
if (elemId == "EXPAND" && errorElement.tagName.toLowerCase() == "textarea" && errorElement.DisplayedProperty) elemId = errorElement.DisplayedProperty;
var lList = $('label[for="' + elemId + '"]', parentTable);
var elList = $('[id="' + elemId + '"]', parentTable);
var elemIndx = -1;
if (elList.length > 1) {
for (var elIndx = 0; elIndx < elList.length; elIndx++) {
if (elList[elIndx] == errorElement) {
elemIndx = elIndx;
break;
}
}
labelForElement = lList[elemIndx];
} else {
var labelList = parentTable.getElementsByTagName("LABEL");
for (var el = 0; el < labelList.length; el++) {
labelList[el].htmlFor = labelList[el].htmlFor.substring(labelList[el].htmlFor.indexOf(".") + 1);
if ((labelList[el].htmlFor == elemId) && (labelList[el].innerText != "")) {
labelForElement = labelList[el];
break;
}
}
}
return labelForElement;
}
</script>
Published May 22, 2019 - 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.