Hidden input value updated from JS, not updating in dynamic binding in AC2

When you update an input from JavaScript the component doesn't know about it, setting the value programmatically doesn't trigger any event.

// get the dom element
const input = document.getElementById('txtDefaultContactCountry');
// update the value
input.value = 'Netherlands';
// trigger a change event to let the App Connect know it was updated
input.dispatchEvent(new Event('change'));
3 Likes