Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8480985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:26:34+00:00 2026-06-10T19:26:34+00:00

I figured out through debugging that I should not name any Form Elements name=submit

  • 0

I figured out through debugging that I should not name any Form Elements name="submit", but even after searching I didn’t find any good explanation of why?

See simple code example below:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
    </head>
    <body>
        <form action="javascript:alert('submitted');" method="post" id="test-form">
            <label>Name</label>
            <input type="text" name="name-field" value="" />
            <input type="submit" name="submit" value="Submit Button" /> <!-- name should not be "submit" -->
            <p><a href="javascript: document.getElementById('test-form').submit();">Submit Link</a></p>
        </form>
    </body>
</html>
  • If you Press Enter while on any Form Element or Click the
    Submit Button, it will work.
  • If you Click on the Submit Link, it will have error

    Unhandled Error: ‘document.getElementById(‘test-form’).submit’ is not a function

If you simply rename your Submit Button to anything other than name="submit" (even if you just capitalize some part of it) or just remove the name="submit" attribute, then both the Submit Button and Submit Link will work.

I tried this in the latest version of Internet Explorer, Firefox, Opera, Chrome, and Safari. All of them have consistent behavior with regards to this.

As you can see in my code example, there is no involvement of jQuery or any other JavaScript library.

I would appreciate the explanation. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T19:26:36+00:00Added an answer on June 10, 2026 at 7:26 pm

    If you check the Mozilla docs here : https://developer.mozilla.org/en-US/docs/DOM/HTMLFormElement

    You will see that forms have a .submit() method.

    In addition, forms are also populated with the fields within the form.

    (Here is one example:
    http://www.devbay.com/articles/javascript/accessing-form-elements-array-with-javascript/
    I can’t find any reference that it should happen, only that it does.)

    So, when you make an element called submit it over-rides the forms built-in submit() method — and since the element is, well, not a function, you get that error message.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have search through the web to figure this out but no luck. I
I figured out how to clone my form rows and append an incriminting number
I have a form and I try to submit it but nothing happens. I
I am trying to figure out my way through c89 and now I ma
I have tried to figure this out and googled through a fair few stack
I've looked through tons of posts and cannot figure out why I can't get
I just went through a bunch of stuff trying to figure out how to
I looked through the other posts and bug reports and couldn't figure out what's
I am trying to implement nhibernate transaction handling through Interceptors and couldn’t figure out
I have been searching for the past through days, trying to figure out how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.