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

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

  1. Create a section with two fields.
  2. Mark both fields as mandatory.
  3. Add them to the process.
  4. 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

Was this useful?

0% found this useful

Have a question? Get answers now.

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

Did you find this content helpful?

Want to help us improve this content?

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