你好,出于某种原因,我的提交按钮不起作用。我尝试了几种方法,我将在下面解释。另外,我应该说我正在使用bootstrap模式。我不确定这是为什么它会以各种方式进行连线。提交无回应
首先是我的表格:
<form name="register" action="register.php" method="post">
<table id="registrationTable" border="0">
<tr id="registrationTR">
<td id="usernameTxt">Username:</td>
<td><input type="text" id="username" class="input" name="username" onChange"checkName(document)">
<br /><p id="registrationInfo">Only alphanumeric, 6-characters minimum</p>
</td>
<td id="username_msg" style="color:red;"></td>
</tr>
<tr id="registrationTR">
<td id="passwordTxt">Password:</td>
<td><input type="password" id="password" class="input" name="password" onChange"checkPassword(document)">
<br /><p id="registrationInfo">6-characters minimum, case-sensitive</p>
</td>
<td id="pwd_msg" style="color:red;"></td>
</tr>
<tr id="registrationTR">
<td>Confirm Password:</td>
<td><input type="password" id="rePassword" class="input" name="rePassword">
<br \><p> </p>
</td>
</tr>
<tr id="registrationTR">
<td id="emailTxt">Email:</td>
<td><input type="text" id="email" class="input" name="email" onChange"checkEMail(document)">
<br \><p> </p>
</td>
<td id="email_msg" style="color:red;"></td>
</tr>
</table>
</form>
然后是我的提交按钮。请注意我已经尝试了两种方式,一种是按钮和一种输入类型,它们都不起作用。是的,我已经拿出了输入类型JS的验证部分,看看它是否工作。
<input type="submit" class="btn btn-primary" name="registerSubmit" value="Submit" />
<button type="submit" class="btn btn-primary" name="registerSubmit" onClick="return validateInfo(document)">Register</button>
JS代码只是为了验证输入字段中是否有任何输入。最后,它返回true或false。我将只显示最后一块它返回true或false:
function validateInfo(document) {
if (checkName(document) && checkPassword(document) && checkRePassword(document) && checkEMail(document)) {
document.getElementById("register").submit();
return true;
}
return false;
}
我甚至试图用document.getElementById("register").submit();
尝试通过JS提交表单,但没有奏效。
现在,它甚至不会加载php文件,所以我不会包含php文件atm。如果需要,我可以根据要求做到这一点。
任何帮助将是伟大的。
在此先感谢。
寄存器形式的名称不能形成ID –
确保您的提交按钮的形式 –
内哪里提交按钮?我没有在你的表格中看到它。 – Styphon