Javascript Error: submit is not a function
Javascript reserved word name collision when calling a form button “submit” and a function “submit”.
Took me a google search to find this one, but for some reason, one of my forms was not submitting using javascript. Find news on SanJose
The reason was the statement “formObj.submit();” in the javascript was colliding (resulting in ambiguity within the browser) with the form button, which was also named “submit”.
ie:
<input type=”submit” name=”submit” value=”Login”>
Change the name of the button to “login” or something else more reflective of it’s functionality instead of “submit”.
javascript:
function submitForm(formId) {
var formObj = document.getElementById(formId);
formObj.submit();
}
html:
<a href=”http://www.homepage.com"
onclick=”submitForm(‘loginForm’); return false”>Login</a>
<form id=”loginForm”>
<input type=”submit” name=”login” value=”Login”>
Your online guide basenotes