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:
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:
Login
Anonymous
July 12, 2005 at 3:05 pm
loosely typed?! try NOT TYPED. thanks for the post. saved me some time in dicking with it.
Anonymous
July 15, 2005 at 10:58 am
I feel especially stupid since I’ve actually had the same problem before.
Anonymous
July 19, 2005 at 6:56 am
I was tearing my hair out on this, thanks!
Jon Lesser
July 20, 2005 at 12:06 pm
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”"
Lunamonkey
August 2, 2005 at 3:07 am
This has been driving me f-in nuts all morning. Thanks!
Eric
August 2, 2005 at 7:17 pm
*punches Javascript in the face*
Thank you very much for this info.
Anonymous
August 4, 2005 at 7:50 am
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!
Anonymous
August 10, 2005 at 12:40 pm
Thanks for posting this. I never would have figured this out.
Mr Nico
August 10, 2005 at 11:58 pm
Wow blogs are usefull! Amazing news. Well done Chovy!
Anonymous
August 16, 2005 at 8:47 am
Yet another satisfied customer. I had this exact error. Thanks for posting useful information! :)
Brendan
August 26, 2005 at 2:36 pm
You are my best friend FOREVER
Anonymous
August 30, 2005 at 12:35 pm
I lost about 3 hours having this problem. Finally I found you post and I fixed it. Thanks man…
Anonymous
September 1, 2005 at 7:52 pm
thank you! what an annoying error… thank god for bloggers. ;)
Anonymous
September 6, 2005 at 10:40 pm
thx a lot for the hint!
Anonymous
September 9, 2005 at 8:33 pm
hi, thanks a lot… it’s really work… i wasted half hour still not solve until found this page…:~~
Anonymous
September 12, 2005 at 3:49 pm
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”)
Anonymous
September 14, 2005 at 8:02 am
thanks!
Anonymous
September 19, 2005 at 9:21 am
Thanks… Spend f**king day for this stupid error :p
Anonymous
September 19, 2005 at 1:34 pm
I just spent the last 4 hours f’ing around with this issue. Thanks.
Moebius
September 26, 2005 at 3:12 pm
Great, great post!
I spent a month searching for a solution !
Anonymous
October 3, 2005 at 12:45 pm
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.
Anonymous
October 6, 2005 at 2:15 am
Thanks for this tip…saved me a lot of head scratching.
Anonymous
October 19, 2005 at 12:20 pm
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
Anonymous
November 11, 2005 at 9:48 am
Godalmighty, thank you! This was baffling me!
Anonymous
November 17, 2005 at 2:52 pm
You rock, thanks for posting this
chovy
November 17, 2005 at 11:52 pm
I love providing the feeling of enlightenment :-D
(at least that’s how I felt when I finally figured it out).
Peter
December 12, 2005 at 7:44 am
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.
JustMe
December 14, 2005 at 4:10 am
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.
Dennis
December 18, 2005 at 5:12 pm
Dude, you are a savior! I spent almost an hour wrecking my brain about this. Thanks!
Jonathan Aquino
December 30, 2005 at 4:13 pm
Add my name to the list of grateful people.
Michael Cooper
January 4, 2006 at 4:04 am
Yep. I too battled away for about an hour on this one.
Thanks very much
row1
January 7, 2006 at 4:54 pm
OMG thank you so much, I just spent the last hour trying to figure out what was wrong!!!
Irek Jozwiak
February 6, 2006 at 3:49 am
Many thanks, man! You saved me a lot of time!
André Pinto
February 7, 2006 at 11:14 am
You saved my, I had exactly the same problem! Thank You!!!!!!!!!!!!
André Pinto, Rio de Janeiro – Brasil
Kail Ceannai
February 9, 2006 at 9:17 am
Thanks!
Andrew
February 9, 2006 at 11:29 pm
Wow, thanks alot for the help!
DaFunky
February 10, 2006 at 10:29 pm
Thanks!
I’ve been looking for hours before finding your tip.
I can sleep now :)
bjand
February 17, 2006 at 3:29 pm
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
Kwun Yeung
February 18, 2006 at 11:05 am
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.
jtuxy
February 22, 2006 at 11:26 am
Many thanx !
Pete O'Bryan
February 27, 2006 at 9:40 am
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.
Iwan
March 6, 2006 at 2:27 am
Thanks for sharing, great job friend.
Hope to find other useful stuffs like this on your site.
Johs
March 9, 2006 at 2:44 am
THANX!
Matt Wall
March 21, 2006 at 8:45 am
Thanks heaps – been coding for 6+ years and that one stumped me for last 45mins!!
Gilbert
April 2, 2006 at 5:24 pm
Thank you. A simple answer to a tricky problem. There is was, a button named form
Stellan Sjögren
April 4, 2006 at 11:49 am
Thanks, I was going crazy on this thing
Uisce
April 7, 2006 at 2:07 am
I’m feeling like a genius — only spent 15 minutes before I googled you up — thanks for the help!
Jevon
April 11, 2006 at 2:18 pm
Thanks as well. That “feature” is totally lame. lol Javascript should be more strict!
MWarner
April 18, 2006 at 10:12 am
Excellent! I just wasted over an hour on this. Many dozens of supposedly expert sites and NO HELP. Where do I send flowers?
Derek Basch
April 19, 2006 at 9:21 am
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.