HTML表单没有提交数据?

时间:2013-01-05 20:02:06

标签: php html forms form-submit splash

我正在尝试为我的网站创建一个Splash页面由Boonex dolphin提供支持,但似乎无法让登录工作。 (它只是让用户再次登录)。

这是代码。

<form id="login_box_form" action="member.php" method="post" onsubmit="validateLoginForm(this); return false;"
      class="form_advanced">
    <input class="form_input_hidden bx-def-font" type="hidden" name="csrf_token" value="cV4xs5rYHF2=caQ68kyq"/>
    <input type="text" name="ID" value="Username" maxlength="20" class="default login" onclick="clearval('Username);"
           style="margin-right: 5px;"/>
    <input type="password" name="Password" value="Password" class="default login" onclick="clearval('Password');"/>
</form>
<a href="member.php" id="loginButton" class="sidebarButton floatLeft" onclick="document.login_box_form.submit();"><span>login</span></a>

有什么想法吗?

(现场演示http://cometogethersupport.pro/splash.php

5 个答案:

答案 0 :(得分:1)

document.login_box_form.submit()

应该是

document.getElementById('login_box_form').submit()

Chrome Developer Tools控制台,这是我在尝试这两个时看到的内容:

> document.login_box_form
  undefined
> document.getElementById('login_box_form');
  <form id=​"login_box_form" action=​"http:​/​/​cometogethersupport.pro/​member.php" method=​"post" onsubmit=​"validateLoginForm(this)​;​ return false;​" class=​"form_advanced">​…​</form>​

答案 1 :(得分:0)

您正在使用表单ID获取表单提交()。或者向表单添加一个属性,如下所示:

<form name="login_box_form"></form>

或将您的函数调用更改为:

onclick="document.getElementById('login_box_form').submit()"

答案 2 :(得分:0)

忍不住注意到这一点:

clearval('Username);

我忍不住要求你改变它!抱歉!

clearval('Username');

另外,为什么不试试这个,假设这是你将数据提交到:

<form  id="login_box_form" action="http://cometogethersupport.pro/member.php" method="post" onsubmit="validateLoginForm(this); return false;" class="form_advanced">

P.S:

(2) Uncaught SyntaxError: Unexpected token ILLEGAL Line 99

更新JQuery?

答案 3 :(得分:0)

好的,我设法用标签中的以下代码解决了这个问题:

    <script type="text/javascript">
function frmSubmit() {
document.login_box_form.submit();
}
</script>

然后将超链接设置为

javascript:frmSubmit();

希望这可以帮助其他人解决这个问题

答案 4 :(得分:0)

您是否尝试从return false代码的onSubmit属性中删除<form

相关问题