JavaScript hints submit is not a function error

Source: Internet
Author: User

I encountered a very strange problem, that is, when using JavaScript to control form submission, the browser prompts document.genForm.submit is not a function. Genform is the name of the form <form>, and another form using the same function is performing normally, looking for a long time also did not find two different, and then searched the Internet for some, the result found the reason.

When the form <form>...</form> contains name= "Submit", there is a conflict when submitting, this error is common on the button, such as:


When the JavaScript does submit (), there will be conflicts, then will name= "submit" to other things such as login and so on, anyway submit in this case is a reserved keyword.


Instance

<form name= "Detailform" action= "adminsearchperformance.do" method= "POST" > <input type= "hidden" value= "${" Userperformance.userid} "name=" UserId "/> <input type=" hidden "value=" ${userperformance.username} "Name=" TeacherName "/> <input type=" hidden "value=" "1" name= "admin"/>
</form> <a href= "Javascript:document.detailForm.submit ();" class= "A-comm" > View details </a></td>

Solutions

<a href= "javascript:document.getall[" Detailform "].submit ();" class= "A-comm" > View details </a></td>

Sometimes it is necessary to submit the form in JavaScript, it is likely that everyone will use Javascript:myForm.submit (), but in doing so how to submit unsuccessful, in the FF view JavaScript errors JavaScript error: The submit is not a function. The reason may be that when the form is submitted with Myform.submit (), the form contains elements of the name= "submit", which, when submitted, will be confused with the Submit () method, causing the error!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.