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

FilePath control OnChange Event does not work as expected

SA-23111

Summary



Configuration: A FilePath control is configured to have an OnChange event coupled with a Refresh Action following a Run activity. Here this activity is used to perform Property-Set of property to true. This property is used in the visible condition of other dynamic layout , which displays its contents if the property is "true".

Issue: OnChange event is not causing the section to refresh and does not display the layout, but the same works fine that is, as expected if the event used is OnClick or OnBlur.

 

Error Messages



Not Applicable.


Steps to Reproduce

  1. Create a section and configure a FilePath control inside a dynamic layout.
  2. Below the FilePath control, place another dynamic layout with Visible condition.
  3. In the Actions tab of the FilePath control, configure the event OnChange, Refresh section-RunActivity.
  4. The activity must set a Flag value such that the dynamic layout Visible condition is set to true.
  5. Navigate to the UI in the portal and try to attach a file using FilePath control and tab out.
  6. Observe whether the layout in step2 is now visible.


Root Cause



A defect in Pegasystems’ code or rules. The control is setting onchange="updateDescription(this);" for it's input and the onChange event Refresh action, runactivity which generates onchange = "handleClientEvent()" causing the problem.

Resolution



Perform the following local-change:

Make few changes in the saveLocalFilePath API and also in the control.

Remove below code for the input: 

 <pega:when java='<%= !tools.getParamValue("pySetValueFromFileName").equals("")%>'>
 onchange="updateDescription(this);"
 </pega:when>


Add similar code in the saveLocalFilePath API, which turns the function.

    function saveLocalFilePath(ids) {
        var fileId = ids["thisId"];
        var fileObj = document.getElementById(fileId);
        if(fileObj != null) {
            var targetId = ids["targetId"];
            var targetObj = document.getElementById(targetId);
            if(targetObj != null) {
                var fileName = fileObj.getAttribute("value");
                if(!fileName || fileName=="") {
                    fileName= fileObj.value;
                }
                if(fileName) {
                    targetObj.setAttribute("value", fileName);
                }
            }
            <pega:when java='<%= !tools.getParamValue("pySetValueFromFileName").equals("")%>'>
            updateDescription(fileObj);
            </pega:when>
        }
    }

 

Suggest Edit

Published May 13, 2016 - Updated October 8, 2020

Did you find this content helpful? Yes No

100% found this useful

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