So ok, I’ve run into this problem in the past where I’m using an onclick event to submit a form from a button control. When you click the button you get a nice little Javascript error stating:
“this.form.submit is not a function”
Bugger…wtf?
This only seems to happen when you have a form element named “submit” already on your page, so the browser treats that “submit” element as an object which is of course NOT a function.
I seem to run into this when I want 2 ways of submitting the form as follows:
<form> ... <input type="submit" name="submit" id="submit" value="Submit Me" /> <input type="button" name="submit2" id="submit2" value="Save Me" onclick="this.form.submit();" /> </form>
Note the name of the submit button is “submit”, hence causing an error
Make sure you don’t name your submit button as “submit” when you want to have multiples submits:
<form> ... <input type="submit" name="btnSubmit" id="btnSubmit" value="Submit Me" /> <input type="button" name="btnSave" id="btnSave" value="Save Me" onclick="this.form.submit();" /> </form>

14 Comments
Very useful information. I wasted some hours in identifying the solution by myself.
You rule man.
Thanks you very much !
you saved my day man!
Thanks, you saved me a good deal of headache.
Using Firefox, the button can be named ’submit’ and the JavaScript still works. The error appears to only be in IE.
Very useful tip, thanks!
doh
thanks, found this page quick enough.
i *did* have this error in firefox, btw
You Rock…
Thanks man..keep it up
Thanks, you saved me a good deal of headache.
Muchas gracias. This was driving me crazy…
Nice short to-the-point solution!
Thanks Michael!
I second that the error does appear in Firefox, too. Thanks for the explanation, it did save me some troubleshooting
Alex
Thanks a million!
Saved me countless hours checking here within the first 5 minutes of searching. Thanks a lot!!