41
Views
1
Comments
onfocus event handler never stops the execution
Question

Hi

On textbox I am giving en event onfocus anf have set it's handler. When focus comes to the textbox, handler executes but it's execution is never stopped. It's getting invoked automatically.


Is this the bug in platform?

Thanks and Regards,

Suraj Borade

2022-05-02 13-50-49
Paulo Ritto

Hi @Suraj Borade ,

After testing the same on my sandbox I have similar behavior, but I think this simply happens because while on debug, the focus will go to your service studio window, and basically when you advance on debug and finish the action flow, the focus goes again back to the browser and to the input field that you had previously focused on, causing the onFocus handler to run again. 

This seems to happen everytime you leave a page you're on and come back. To prove this you can do the following exercise:

  1. Focus the input element (handler runs once)
  2. Now open a different tab in your browser / minimize your browser's window
  3. Open the browser window again / go back to the tab where you are running your Outsystems app, and notice the handler will run again as soon as you go back to your app's tab (as your input was the last element that you focused before switching tabs/windows!!!


So yes may be a unexcepted behavior while debugging, however you can confirm that at runtime the Handler does NOT run multiple times (as long as your user stays on the app window), and only runs when input is focused. 

My point is: the "bug" you are getting while debugging is justifiable because of what I described above, and should not affect your actual app behavior in runtime


In any case if you really need this behavior to not happen at runtime while going to other tabs/windows, I will try to investigate further if that is possible and will get back to you if I find something!

Kind regards,

Paulo

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.