On-change not triggered when input cleared

On-change not triggered when input cleared

  

Hi there, 

I have an input box which is linked to an autocomplete widget. When the input box is blank, I show a button with-which the user can add new contacts. However, once an input has been selected, this option disappears. 

The problem I have is that I want to show the "Add new" button again if I delete the contents of the box, but I can't. Essentially I want to simply trigger an ajax refresh on the If-statement that determines the visibility of the button. However, whenever I clear the contents of the input, the on-change event of the input is not triggered and, as such, I have no way of refreshing the if-statement (so, I can't make the Add-new button reappear). 

Any thoughts on how I might make the button appear again?

Kind regards,

Cole


 

How are you clearing the input?

If you are clearing with backspace and then triggering the logic with "OnChange", validate if your onChange is using "Ajax Refresh" and not "Navigate" or "Submit".


If you are clearing with Javascript or Outsystems logic, then I'll ask you to post the code or at least an explanation on how you are doing it and I'll answer accordingly.

Hi Cole,

Could it be the Autocomplete is interfering with the OnChange? If you remove the Autocomplete, does it work again?

flpmorais wrote:

How are you clearing the input?

If you are clearing with backspace and then triggering the logic with "OnChange", validate if your onChange is using "Ajax Refresh" and not "Navigate" or "Submit".


If you are clearing with Javascript or Outsystems logic, then I'll ask you to post the code or at least an explanation on how you are doing it and I'll answer accordingly.

Thanks for your reply. 

My OnChange screen action is using an ajax refresh. As Killian suggested, it works fine without the autocomplete. 

OnChange Actions are by definition Ajax Submit, so Refreshes should work fine. As it works without the Autocomplete, my guess is that the Autocomplete captures the OnChange, which makes sense as with every keystroke the suggestions should be changed.

Kilian Hekhuis wrote:

OnChange Actions are by definition Ajax Submit, so Refreshes should work fine. As it works without the Autocomplete, my guess is that the Autocomplete captures the OnChange, which makes sense as with every keystroke the suggestions should be changed.


hmm,  strange, the on-change for the autocomplete does not actually trigger after every keystroke (it seems). 

So clearing the box also does not work for me.