Triggering the `change_form` event when the input's value is changed programatically

Hi -

I’m noticing that the change_form event gets fired correctly if I type a new value into my input. However if I change the value of that input programatically the change_form event does not get fired.

For example if I do document.getElementById('inputID').value = "test", the event will not fire.

Is there a way to have this example fire off a change_form event?


@postfactum, you might consider the dynamic capability of the form tracking: (I haven’t tried it myself to be sure).

@ihor Thanks for the reply. I was able to solve it by manually dispatching a change event once the value gets changed. I think I might be able to take advantage of the transform capability by including the logic in there.


I think whether this event fires or not when you programatically modify the DOM will probably vary by browser. The eventListener binds to ‘onchange’ within a form - so I believe that whilst some browsers may dispatch an event if the DOM is modified others may not.

The spec isn’t super clear about the implementation but the spirit of it seems intended towards events being dispatched from user actions.