I have been trying to set the input values on a public DHL form in all the different ways the internet suggests, but it does not work.
I've tried the many Stack Overflow answers on this topic, but this form is just special.
The classic way to set the value of the "first and last name" field:
// using firefox browser developer console:
var input = document.getElementById('address.receiver.name2');
input.value = 'John'; // has a temporary effect
// or
input.setAttribute('value', 'John'); // doesn't work
Setting input.value = 'John'; shows the value inside the input field.
But any clicking inside and around the form or submitting the form, removes the value again.
Only the value that is manually typed in by hand, is preserved in the form.
I see that there is multiple events on the input field. I failed to either disable or trigger them. Also, the contents of the form are saved. Navigating and refreshing keeps the content. Seems to be a lot of magic going on.
I want to set the values of the input fields.
But any clicking inside and around the form ...removes the value again; sounds like there is another event firing on the form itself. You'll need to investigate that.