document.getElementById('form_name').submit() not working properly

Posted by Leahn Novash on Stack Overflow See other posts from Stack Overflow or by Leahn Novash
Published on 2010-06-13T17:03:22Z Indexed on 2010/06/13 17:12 UTC
Read the original article Hit count: 128

Filed under:
|
|

Ok, I will try to give the most details I can.

The site is not suposed to work with IE6. It would be nice if it worked with IE8 and Chrome, but that can be done later.

The site is in PHP. The form where the submit is in another PHP file that is included in position on the index.php inside of a DIV tag.

If I open the form solely, the submit works correcly, but when I try to submit on the index page, the Firefox error console says that document is undefined. The form code is echoed line by line via PHP. Save the text fields for username and password, the form code is the following:

<form id="entrar" action="entrar.php" method="post" onsubmit="javascript:checkvalues();">
  <a href="javascript:document.getElementById('entrar').submit();">ENTRAR</a>
</form>

What's the big deal? What am I missing here? I know it is something very silly but I can't figure it out.

© Stack Overflow or respective owner

Related posts about php

Related posts about JavaScript