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

Screen does not focus on error containing field on submit

SA-100981

Summary



When a Validation is added to a property and an invalid field submitted, the Validation error does not receive focus automatically.


Error Messages



Not Applicable


Steps to Reproduce

  1. Add validation on a property.
  2. On Submit, ensure that the property value fails validation. Error displays at the top section of the screen. However, the focus is not on the error.


Root Cause



This behavior is as per Pega product design.


Resolution



Perform the following local-change:
  1. Add a Run Script on the Submit button and provide the setFocusOnErrorList function.
  2. Add the below script to the UserWorkForm. In the JavaScript API, invoke the setFocusOnErrorList() function:

    <script>
    function setFocusOnErrorList(){
        setTimeout(function(){
            var e = document.getElementsByClassName("iconErrorDiv"); 
            e = e[0]; 
            if(e && e.firstChild){
                e.parentNode.tabIndex = "0"; 
                e.parentNode.focus(); 
            }
        },5000);

    </script>

Published February 12, 2020 - Updated December 2, 2021

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