I am using APEX 22.2.4.
I need to run some code whenever user selects a value from the lov’s data displayed when user starts to enter some letters in the field or when they leave the field without picking up a value from the list.
Unfortunately, the new behavior of text field with autocomplete makes the change event fires only when user tries to leave the item or press the Enter key.
I think what I need is a combination of the "On Update" and "On Change" dynamic actions. But "On Update" DA is not there any more.
Is there a way to accomplish that?
2
Answers
You could create 2 dynamic actions. As you said, the "Change" event only fires when the actual value is chosen.
To capture any key presses, add a 2nd dynamic action of type "Key Down" – that will fire whenever the user presses a key in the field.
If you don’t want to fire it on each key press, but wait a bit (eg when user types 3 letters don’t fire 3 times, then you could set the type to debounce with a time of 300 (milliseconds that is).
As I’ve understood, you’ve two scenarios,
You can use
Key Down / Press / Release
events as per necessity.You can also check https://stackoverflow.com/a/55280923/10833813. This link is of different question, but you can get an idea, how to execute any code on key press.
You can use
Lose Focus
event and check the item value, either using JavaScript or PLSQL code.