I have something like this in my web forms:
<input type="hidden" name="myField" value="defaultValue" />
Later on, in some Javascript, I am overwriting the default value before I submit the page to the server.
var formField = document.getElementsByName("myField")[0];
formField.setAttribute("value", "myNewValue");
var form = document.getElementById("myForm");
form.submit();
All browsers (I tested this code over years in IE5-IE8, Firefox, Opera, Chrome, Safari, ...) are sending "myNewValue" to the server. Except IE9: It sends "defaultValue". What's going on here? Am I missing something?
If I remove the "value" attribute from the field, it also works in IE9. It also works in IE9 if I switch to IE8 rendering mode.
Is this a bug or is IE9 more standards compliant than the other browsers?