chapter31

development in a land far far away…

at the moment

History is not what happened. History is what was written down.

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:

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:


Related Pages

  • No related posts

6 Responses to “When not to use this.form.submit()”

  1. Very useful information. I wasted some hours in identifying the solution by myself.

    Vignesh

  2. You rule man.
    Thanks you very much !

    neiluJ

  3. you saved my day man!

    shocker

  4. Thanks, you saved me a good deal of headache.

    Gordon

  5. Using Firefox, the button can be named ’submit’ and the JavaScript still works. The error appears to only be in IE.

    Gary

  6. Very useful tip, thanks!

    Sean

Leave a Reply