OnChange event behaviour

Hi there,

I noticed than OnChange event does not fire when changing the input value with a workflow.
I think it should execute every time the value of the input changes - with another workflow or with interaction by the user.

In such a case what is the best way to execute OnChange workflow when a value of the input changes via another workflow?

if you are changing the input value because the initial value is bound to a variable and you are changing that variable with a workflow then you want to use the “on init value change” trigger.
If you are change the HTMLInputElement value directly with a js action you need to also dispatch a change event from that element to get weweb’s change workflow triggered.

Unfortunately I cannot use “on init value change” trigger because of several possible interactions on the form.

It also seems that “classic” dispatchEvent() on the input is not working and it is not executing “on change” workflow after changing input value without user interaction.

This is not a “deal breaker” but requires couple of workflows more :slight_smile:

It definitely seems for me that onchange dispatches only after user interaction with a control.

have you tried to put your onchange logic in a global workflow that you can trigger both on the input onchange and in the other workflow that is programmatically changing the initial value?

I think your suggestion will do the job :slight_smile: - thanks for that!

1 Like

Hi Dominic, what dorilama suggests is the best approach :slight_smile:
The current behavior is by design, to avoid some loop to happen

2 Likes