We are having a problem with a web application that uses Dojo 1.9. The application works fine in Chrome, Firefox and IE 10/11 but we are getting reports of a problem in IE 7.
UNFORTUNATELY, I have no way to test this directly because by corporate directive, IE 7 was removed from all developer machines. So I am responsible for fixing a bug I have no way to duplicate.
Because of user feedback, all the buttons in the application were changed from type="submit" to type="button" and an onclick() handler was added to the buttons so that the form would be submitted only when the button was clicked but not when ENTER was pressed. Here is the dojo/domReady! code that wires the buttons:
// Make the buttons submit the form ONLY on click (avoid keypress)
query("button[type='button']").on("click", function(e) {
console.log(" in button onclick handler");
// This actually submits the form based on the button that was clicked
myapp.core.buttonClick("applicationInfo",this);
console.log(" leaving button onclick handler");
})
Here is the routine that actually submits the form (myapp.core.buttonClick):
myapp.core.buttonClick = function(formName, buttonObject) {
// Have to do this to transmit the data - the button info
// won't be transmitted otherwise
var formObject = document.forms[formName];
var newField = document.createElement('input');
newField.type = 'hidden';
newField.name = buttonObject.name;
newField.value = buttonObject.value;
formObject.appendChild(newField);
formObject.submit();
}
Can anybody familiar with IE7 spot the problem in this code? Thanks in advance...