Error on change form action

Posted by Thomas on Stack Overflow See other posts from Stack Overflow or by Thomas
Published on 2010-06-08T13:53:26Z Indexed on 2010/06/08 14:02 UTC
Read the original article Hit count: 367

Hi, I'm changing the form action with:

window.onload = function() {
    document.getElementById('pdf').onclick = addExportEvent;
    document.getElementById('xls').onclick = addExportEvent;
    document.getElementById('xml').onclick = addExportEvent;
    document.getElementById('csv').onclick = addExportEvent;
}

function addExportEvent() {
    data = grid.getAllGridData();
    document.getElementById('dados').setAttribute('value', encodeURIComponent(JSON.stringify(data)));

    formulario = document.getElementById('formulario'); // Line 55!
    formulario.action = 'php/' + this.id + '.php';
    formulario.submit();

    return false;
}

But it doesn't work with Internet Explorer. It returns the following error:

Message: The object doesn't support the property or method.
Line: 55
Character: 2
Code: 0
URI: http://www.site.com/javascript/scripts.js

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about internet-explorer