I'm creating a chrome extension for internal use in my organization.
One of the features is to auto-fill some forms to save time.
normally, this should be done something like this:
document.getElementById("field1").value = "new value";
When doing this, the input field seems to behave as expected and displays the new value. However, when a users clicks in the field, it becomes empty again. Furthermore, if i try to submit the form without clicking in the field, it displays an error message as if the field was empty.
I also tried to dispatch an input event on the field like this:
document.getElementById("field1").dispatchEvent(new Event("input", {composed: true, bubbles: true, cancelable: false}));
But it doesn't help.