Skip to content Skip to sidebar Skip to footer

Why Doesn't This Dojo 1.9/JS Code Work In Internet Explorer 7?

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. U

Solution 1:

Short Answer: IE7 and Spring Web Flow are not compatible.

Long Answer:

Not only does Dojo 1.9 not support IE 7, but IE7 turns out to be very problematic with Spring Web Flow. Because IE7 submits all buttons to the server, regardless of what button is clicked, it is a hassle to pass Web Flow events back to the server using IE7 and required a very ugly hack:

var formObject = document.forms[formName];
//  Rip out the buttons because IE7 sucks
for (i=0;i<formObject.length;i++) {
    if (formObject[i].tagName === 'BUTTON') {
        formObject[i].parentNode.removeChild(formObject[i]);
        i--;
    }
}
var newField = document.createElement('input');
newField.type = 'hidden';
newField.id=buttonObject.id;
newField.name = buttonObject.name;
if (buttonObject.attributes['value'] != null) {
    newField.value = buttonObject.attributes['value'].value;
} else {
    newField.value = buttonObject.value;
}
formObject.appendChild(newField);
formObject.submit();

This hack basically rips out all the button objects from the form, then adds back the one button that was actually clicked as a hidden field, and then submits the form.


Post a Comment for "Why Doesn't This Dojo 1.9/JS Code Work In Internet Explorer 7?"