submit is not a function
means that you named your submit button or some other element submit
. Rename the button to btnSubmit
and your call will magically work.
When you name the button submit, you override the submit()
function on the form.
ID : 10424
viewed : 19
Tags : javascripthtmldomsubmitjavascript
95
submit is not a function
means that you named your submit button or some other element submit
. Rename the button to btnSubmit
and your call will magically work.
When you name the button submit, you override the submit()
function on the form.
82
<form action="product.php" method="post" name="frmProduct" id="frmProduct" enctype="multipart/form-data"> <input id="submit_value" type="button" name="submit_value" value=""> </form> <script type="text/javascript"> document.getElementById("submit_value").onclick = submitAction; function submitAction() { document.getElementById("frmProduct").submit(); return false; } </script>
EDIT: I accidentally swapped the id's around
71
If you have no opportunity to change name="submit"
you can also submit form this way:
function submitForm(form) { const submitFormFunction = Object.getPrototypeOf(form).submit; submitFormFunction.call(form); }
65
Make sure that there is no another form with the same name and make sure that there is no name="submit"
or id="submit"
in the form.
53
I had the same issue when i was creating a MVC application using with master pages. Tried looking for element with 'submit' as names as mentioned above but it wasn't the case.
For my case it created multiple tags on my page so there were some issues referencing the correct form.
To work around this i'll let the button handle which form object to use:
onclick="return SubmitForm(this.form)"
and with the js:
function SubmitForm(frm) { frm.submit(); }