Action Set action runs even when When rule returns False. How to not get this action to run?
I am developing an Action Set with event 'onChange' on a text area. When the onChange runs, it will first refresh the section holding the text area and then launches a local action. The order is (1) Refresh-ThisSection and then (2) Launch Local Action (Modal WIndow). I have placed a When rule on the local action checking if the length of the text area equals a set amount (let's say 10 for example).
The action is running even when my When rule returns False sometimes. The times that it returns False is when I have 10 characters in the text area and then delete 1. The length will be 9 now and my When rule returns False as the length is not equal to 10. However, the local action still launches and the modal window appears. I close the window and then enter a character making the length 10. The section refreshes and the when rule returns True, but the local action launch does not occur.
I have also tried this with Post Value instead of Refresh-ThisSection and the When rule still performs the same way but the local action runs even when the When rule tied to it returns False. Does anyone have any insight as to why this may be happening?
Also tried placing a hidden property within the section that the When rule is configured on the action of our text area for and then performing a Set-Value on the text area (configured according to the solution from this article https://pdn.pega.com/community/product-support/question/launching-local…) and that did not launch the modal window either. Any help would be greatly appreciated. Thanks!
Thanks for the information and suggestion. We had that configuration set up for our text areas already and with that set up, it shows the Remaining count below the text area. We also need to configure a window to appear when the max limit has been reached using OnChange and Launch Local Action. Right now it works for most scenarios. Our main issue is the OnChange event runs properly when you enter text into a blank text area on the first time entering data into the area, however the launch local action does not run then.
The problem is that when you have multiple actions on a single OnChange, the DOM model of the browser is only updated under certain situations for each interaction and so the When condition of your 2nd action doesn't really reflect what is true at that specific point in time FROM THE BROWSER's DOM model perspective.
I found that I can control actions dynamicaly using When if I used a property that is visible on the screen and is non read-only as a flag to be checked in the action When condition. The property must be visible and editable but it can be disabled. Your first action must do refresh-this-section and set the property to a specific value which you can determine to do the 2nd action or not and your 2nd action use When condition to check the property value. It works for 7.2.2 in my case.