gpt4 book ai didi

javascript - 保持提交按钮禁用,直到表单完成并确认密码

转载 作者:行者123 更新时间:2023-12-02 19:22:27 24 4
gpt4 key购买 nike

我知道已经有很多关于此的帖子,但无论我尝试什么,都对我的表单不起作用。

我只是希望在填写所有字段之前禁用提交按钮,并且希望在提交之前将 $mypassword 检查为等于 $myconfirmpassword

如果你能找到有用的东西。非常感谢!

显然,出于隐私目的,有些内容被隐藏,因为您看不到我的 CSS 和 PHP 信息。

<div id="container" style="height:700px;">
<a href="login.php" class="anchor"><div id="back">
<h2>Back</h2>
</div></a>
<div id="registration_container" >
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FF9">
<tr>
<form name="form3" method="post" action="check_finish_registration.php">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FF9">
<tr>
<td colspan="3"><strong>Complete Registration </strong></td>
</tr>
<tr>
<td width="2000">First Name</td>
<td width="6">:</td>
<td width="294"><?php echo $fname ?></td>
</tr>
<tr>
<td width="2000">Middle Name*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="mymname" id="mymname"></td>
</tr>
<tr>
<td width="2000">Last Name</td>
<td width="6">:</td>
<td width="294"><?php echo $lname ?></td>
</tr>
<tr>
<td width="2000">Create a Username*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="myusername" id="myusername"></td>
</tr>
<tr>
<td width="2000">Create a Password*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="mypassword" id="mypassword"></td>
</tr>
<tr>
<td width="2000">Confirm Your Password*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="myconfirmpassword" id="myconfirmpassword"></td>
</tr>
<tr>
<td width="2000">Enter your Sigma Number*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="mysnumber" id="mysnumber"></td>
</tr>
<tr>
<td width="2000">E-Mail Address*</td>
<td width="6">:</td>
<td width="294"><input type="text" name="myemail" id="myemail"></td>
</tr>
<tr>


<td width="2000">* required field</td>
<td>&nbsp;</td>
<td><input type="submit" id='register' value="Register"disabled='disabled'></td>
</tr>
</table>
</td>
</form>

</tr>
</table>
</div>
</div>

最佳答案

为什么不尝试验证表单,而不是禁用提交按钮,以便在用户输入正确的值之前,表单不会提交到数据库?关于密码和确认密码字段验证

   <script type="text/javascript">
function passwordConfirm() {
var confirmPass = document.getElementById("confirmpassid").value
if(pass != confirmPass) {
alert("Mismatching passwords");
}
}

关于javascript - 保持提交按钮禁用,直到表单完成并确认密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12380824/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com