Tuesday, April 24, 2012

document.formname.submit() is not a function or not working

When we are trying to submit a form using java script some times it will not working properly.

Find the below case

I have form like this

<form name="myform" method="post">
  <input type="text" name="name" value="">
  <input type="submit" name="submit" value="GO">
</form>

Here i am trying to submit the the form using java script
<script>
      document.myform.submit();
</script>

Error:- document.myform.submit() not a function

I have solution here change form submit name

<input type="submit" name="register" values="Go">

Don't put the form submit name as submit.





No comments:

Post a Comment