Payment method input boxes disabled by default – interesting Javascript incompatibility

This bit of code is in Magento’s default theme for onepagecheckout – upon load it calls payment.init() which is an object literal function:

init : function () {
    var elements = Form.getElements(this.form);
    var method = null;
    for (var i=0; i<elements.length; i++) {
        if (elements[i].name=='payment[method]') {
            if (elements[i].checked) {
                method = elements[i].value;
            }
        } else {
            elements[i].disabled = true;
        }
    }
    if (method) this.switchMethod(method);
},

For some reason, in IE9 only, it seems that the input boxes in the payment form default to “disabled=true”… is there a better way to accomplish this? IE9 is the only one that misbehaves here…

Update:

My temporary fix has been to disable this call altogether. We do not require hidden fields to be disabled. Is this a requirement to maintain compatibility?

One thought on “Payment method input boxes disabled by default – interesting Javascript incompatibility”

Leave a Reply

Your email address will not be published. Required fields are marked *