Problem Passing Variable to Submit Form in Firefox

Posted by George on Stack Overflow See other posts from Stack Overflow or by George
Published on 2010-03-11T21:46:52Z Indexed on 2010/03/11 21:49 UTC
Read the original article Hit count: 234

Filed under:
|
|
|
|

In the following example, I have a link that sends a variable to a function which checks if the variable is true and, if so, submits a form on the page. This has been tested and works in IE, Safari, and Chrome, but not Firefox. Trying to figure out what's wrong in Firefox.

The function which checks 'action' and then submits form 'login' :

function submit(action) {
    if (action == "submit") {
        document.login.submit();
    }
}

Link to pass action variable and submit form:

<a href="javascript:submit('submit');">SEND FORM</a>

When I remove the check and just have the following, it works fine in Firefox:

function submit() {
    document.login.submit();
}

<a href="javascript:submit();">SEND FORM</a>

© Stack Overflow or respective owner

Related posts about forms

Related posts about firefox