开发者

Why is form.submit() not working?

I have the following snipet in a page. I cannot for the life of me figure out why the form is not submitting when clicking the button1 element. I get an error in IE开发者_JAVA百科 syaing that this object does not support this property or method. I put the document.poform in an alert, and it alerts a form object. I get the feeling that I am missing something super obvious maybe??

<pre>
<?
    var_dump($_POST);
?>
</pre>
<form action="" method="post" name="poform">
    <input name="test" type="text" />
    <input name="button" type="button" value="button1" onclick="document.poform.submit();" />
    <input name="submit" type="submit" value="button2" />
</form>


Since you have an <input> named submit, document.poform.submit is that <input>, not the submit() method.

Use a different name.


Change type="button" to type="submit"

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜