• Skip to content

Menu 1

  • Zug
  • Blog
  • Local
  • Printed
  • Projects
  • Railroad
  • Podcasts
  • Newsletter

Thomas Beutel Art

Menu 1

  • Zug
  • Blog
  • Local
  • Printed
  • Projects
  • Railroad
  • Podcasts
  • Newsletter

Follow us

Follow us on TwitterFollow us on InstagramFollow us on PinterestSubscribe to our Channel on YouTubeFollow us on SoundCloud
AuthorPostedbyThomason September 15, 2009

Result of expression ‘document.forms[0].submit’ [[object HTMLInputElement]] is not a function.

I was trying to add a small delay into my form submission like so:

<form ... onsubmit="setTimeout('document.forms[0].submit()',2000);return false;">

but everytime I tried it, I got the following error:

Result of expression 'document.forms[0].submit' [[object HTMLInputElement]] is not a function.

This one had me stumped, until I realized what it was telling me… that my submit button was named “submit”.

<input type="submit" name="submit" id="Button1" />

I changed the name of the submit button and the problem went away.

<input type="submit" name="button1" id="Button1" />

Basically, Javascript provides a “convenience” by adding the names of the form inputs as children of the form. But this then clashes with preset function names, like the submit() function.

♡

Posted in javascript, jQuery, ProgrammingTagged javascript

13 Comments

  1. Liza
    16 years ago Permalink

    Thanks, I had this exact problem. Googling for error messages saves the day.

  2. Russell
    16 years ago Permalink

    You are the man! I have been troubleshooting this for hours. It's always the simplest explanation. Thanks for pointing this out!

  3. Wayne
    15 years ago Permalink

    Thank you for this post! I have been fighting this for about 20 minutes, until I saw this.

  4. fmele
    15 years ago Permalink

    It's not a matter of preset functions, because it happens with all LOADED functions, not the inline ones:
    //script included:
    function f() {
    alert(“I'm going do submit”);
    }
    // html:
    <form action=”f.html” id=”f” name=”f”>
    <button onclick=”f()” type=”button”>GO</button>

    This code runs in the same error (probably because DOM object's ids and function's names share same memory and the Javascript Engine returns the first occurrence, that's the DOM one).</form>

  5. fmele
    15 years ago Permalink

    It's not a matter of preset functions, because it happens with all LOADED functions, not the inline ones:
    //script included:
    function f() {
    alert(“I'm going do submit”);
    }
    // html:
    <form action=”f.html” id=”f” name=”f”>
    <button onclick=”f()” type=”button”>GO</button>

    This code runs in the same error (probably because DOM object's ids and function's names share same memory and the Javascript Engine returns the first occurrence, that's the DOM one).</form>

  6. Michelle
    15 years ago Permalink

    Thank you. It is people like you that saves headaches when googeling error-messages, would have taken me forever without you <3

  7. Gb
    14 years ago Permalink

    You saved me from going insane with this problem. Thanks

  8. Gocaballero
    14 years ago Permalink

    Seems like I run into this problem about once year and it is sites like this that save my ass.

    Thank you!

  9. James
    14 years ago Permalink

    I was confused by this too..thanks..this really helped! James

  10. Thomas Beutel
    14 years ago Permalink

    I'm glad it helped! – Thomas

  11. Dominic
    13 years ago Permalink

    Thanks for posting this. Saved me a ton of time figuring out why my form was broken in Safari.

  12. Bethany
    13 years ago Permalink

    It would have taken me forever to figure this out on my own. Thank you and thank google! 🙂 

  13. Rob
    12 years ago Permalink

    You saved me a lot of searching – thank you!

Comments are closed.

Post navigation

Previous
Next

© 2025MINIMAL

Follow us

Follow us on TwitterFollow us on InstagramFollow us on PinterestSubscribe to our Channel on YouTubeFollow us on SoundCloud
x