问题描述
我知道有很多关于这方面的文章,但无论我尝试什么,我的表单都没有任何作用。
我只希望直到所有字段都填写为止,提交按钮才会被禁用,并且我希望 $ mypassword
已选中在提交之前等于 $ myconfirmpassword
。
如果你能找到有用的东西。非常感谢你!
显然,有些东西是隐藏在隐私之中的,因为你看不到我的CSS和PHP信息。
< div id =containerstyle =height:700px;>
< a href =login.phpclass =anchor>< div id =back>
< h2>返回< / h2>
< / div>< / a>
< div id =registration_container>
< tr>
< form name =form3method =postaction =check_finish_registration.php>
< td>
< tr>
< td colspan =3>< strong>完成注册< / strong>< / td>
< / tr>
< tr>
< td width =2000>名字< / td>
< td width =6>:< / td>
< td width =294><?php echo $ fname?>< / td>
< / tr>
< tr>
< td width =2000>中间名*< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =mymnameid =mymname>< / td>
< / tr>
< tr>
< td width =2000>姓氏< / td>
< td width =6>:< / td>
< td width =294><?php echo $ lname?>< / td>
< / tr>
< tr>
< td width =2000>建立使用者名称< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =myusernameid =myusername>< / td>
< / tr>
< tr>
< td width =2000>建立密码*< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =mypasswordid =mypassword>< / td>
< / tr>
< tr>
< td width =2000>确认您的密码*< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =myconfirmpasswordid =myconfirmpassword>< / td>
< / tr>
< tr>
< td width =2000>输入您的Sigma编号*< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =mysnumberid =mysnumber>< / td>
< / tr>
< tr>
< td width =2000>电子邮件地址*< / td>
< td width =6>:< / td>
< td width =294>< input type =textname =myemailid =myemail>< / td>
< / tr>
< tr>
< td width =2000> *必填字段< / td>
< td>& nbsp;< / td>
< td>< input type =submitid ='register'value =Registerdisabled ='disabled'>< / td>
< / tr>
< / table>
< / td>
< / form>
< / tr>
< / table>
< / div>
< / div>
解决方案为什么不禁用提交按钮你只是尝试验证表单,以便直到用户输入正确的值,表单才会被提交到数据库?关于密码和确认密码字段验证
< script type =text / javascript>
函数passwordConfirm(){
var confirmPass = document.getElementById(confirmpassid)。value
if(pass!= confirmPass){
alert(密码不匹配);
}
}
I know that there are a bunch of posts about this already, but no matter what I try, nothing works for my form.
I simply want the submit button to be disabled until all fields are filled in, and I want $mypassword
checked to equal $myconfirmpassword
before submitting.
If you can find something that works. THANK YOU SO MUCH!!
Obviously, some things are hidden for privacy purposes, as you can't see my CSS and PHP info.
<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> </td>
<td><input type="submit" id='register' value="Register"disabled='disabled'></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
</div>
</div>
解决方案 Instead of disabling the submit button, why don't you just try to validate the form so that until the user enters the correct values, the form will not be submitted to the database? And about the password and confirm password fields validation
<script type="text/javascript">
function passwordConfirm() {
var confirmPass = document.getElementById("confirmpassid").value
if(pass != confirmPass) {
alert("Mismatching passwords");
}
}
这篇关于保持提交按钮被禁用,直到表单完成并确认密码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-18 23:07
-
将数据从Excel导入表时出错
-
在背压时关闭引导模式
-
更新触发器PL/SQL Oracle
-
R Barchar在For循环中不起作用
-
比较PostgreSQL中的字符串
-
如何在每个请求上运行 shell 脚本?
-
限制对HTTP GET请求的响应中读取的数据量
-
orderBy 两个字段(一个反向)
-
安装 debug_inspector (0.0.2) 时出错,Bundler 无法继续
-
在Matlab中使用rand函数时出错
-
如何将单个列分成2列
-
C#调用oracle存储函数
-
从多个列中选择:codeIgniter
-
动态SQL Server存储过程
-
在Visual Studio2008内部SQL Server中创建存储过程
查看更多