Took me a google search to find this one, but for some reason one of my forms was not submitting using javascript.
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">
</form>
loosely typed?! try NOT TYPED. thanks for the post. saved me some time in dicking with it.
I feel especially stupid since I’ve actually had the same problem before.
I was tearing my hair out on this, thanks!
I had a similiar problem when using a form button to call a function on click. The name of the button had to be different fro the function I was calling.
Did NOT work:
input type=”button” name=”newGame” value=”New Game” onClick=”newGame(); return false;”
Did work:
input type=”button” name=”New Game” value=”New Game” onClick=”newGame(); return false;”
The error in firefox’s console was “Error: newGame is not a function”
Thanks for the tip Chovy! You are the top hit when I google, “javascript error “is not a function”"
This has been driving me f-in nuts all morning. Thanks!
*punches Javascript in the face*
Thank you very much for this info.
yes thanks man, I also had a similair type problem – I had a function and it was calling the first time, but everytime after I was getting the error “userinfo is not a function” it turned out that the function name was clashing with some element id’s – strange but anyway, you need to be careful with the naming conventions!
Thanks for posting this. I never would have figured this out.
Wow blogs are usefull! Amazing news. Well done Chovy!
Yet another satisfied customer. I had this exact error. Thanks for posting useful information! :)
You are my best friend FOREVER
I lost about 3 hours having this problem. Finally I found you post and I fixed it. Thanks man…
thank you! what an annoying error… thank god for bloggers. ;)
thx a lot for the hint!
hi, thanks a lot… it’s really work… i wasted half hour still not solve until found this page…:~~
awesome – i feel so dumb, but this has been tripping me up for a few days off and on. thanks for posting it! (you’re #1 result for “submit is not a function”)
thanks!
Thanks… Spend f**king day for this stupid error :p
I just spent the last 4 hours f’ing around with this issue. Thanks.
Great, great post!
I spent a month searching for a solution !
Thanks for the post, I spent over an hour bashing my head against the wall before I bothered to Google it. Yours was the first result, and the only one I needed to look at.
Thanks for this tip…saved me a lot of head scratching.
thank you so much for the tip. i have been baffled by this for a few days now and just decided to do a google on the error. fortunately your page popped up first and it took me directly to the answer!
thanks
Lura
Godalmighty, thank you! This was baffling me!
You rock, thanks for posting this
I love providing the feeling of enlightenment :-D
(at least that’s how I felt when I finally figured it out).
My god, thank you so much. Just another reason why I F’n hate JavaScript and it’s million and one quirks.
You’re a lifesaver. Thanks.
Wasted one hour and a half on this stupid thing.
Thanx alot for pointing this out. I also came here by firing “submit is not a function” against google.
Dude, you are a savior! I spent almost an hour wrecking my brain about this. Thanks!
Add my name to the list of grateful people.
Yep. I too battled away for about an hour on this one.
Thanks very much
OMG thank you so much, I just spent the last hour trying to figure out what was wrong!!!
Many thanks, man! You saved me a lot of time!
You saved my, I had exactly the same problem! Thank You!!!!!!!!!!!!
André Pinto, Rio de Janeiro – Brasil
Thanks!
Wow, thanks alot for the help!
Thanks!
I’ve been looking for hours before finding your tip.
I can sleep now :)
I had a similar problem.
Thanx to this blog, I noticed, that
You have to specify a different name to submit button.
for example:
will not work
will work
Thanks! You saved me! I spent hours figuring out what the “submit is not a function” means. Finally my codes are working now. I think I will even delete all useless names for the submit buttons to avoid this collision.
Many thanx !
I would like to be the forty-third person to thank you for publishing this discovery with such a googleable page title. BRILLIANT!!! I can go to lunch now.
Thanks for sharing, great job friend.
Hope to find other useful stuffs like this on your site.
THANX!
Thanks heaps – been coding for 6+ years and that one stumped me for last 45mins!!
Thank you. A simple answer to a tricky problem. There is was, a button named form
Thanks, I was going crazy on this thing
I’m feeling like a genius — only spent 15 minutes before I googled you up — thanks for the help!
Thanks as well. That “feature” is totally lame. lol Javascript should be more strict!
Excellent! I just wasted over an hour on this. Many dozens of supposedly expert sites and NO HELP. Where do I send flowers?
I too wasted an hour of my life on this stupid error. I might as well go smoke 8 packs of Marlboros and waste a few more.