i have written a javascript code for mobile number and state validation but function is working except mobile number and state validation , where is my mistakes ?
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript">
function checkForm(form)
{
if(form.email1.value != "" && form.email1.value == form.email2.value)
{
}
else
{ alert("Error: Please check that you've entered and confirmed your email id!");
form.email1.focus();
return false;
}
if(form.pwd1.value != "" && form.pwd1.value == form.pwd2.value)
{
if(form.pwd1.value.length < 6)
{
alert("Error: Password must contain at least one characters!");
form.pwd1.focus();
return false;
}
if(form.pwd1.value == form.email.value) {
alert("Error: Password must be different from Username!");
form.pwd1.focus();
return false;
}
re = /[0-9]/;
if(!re.test(form.pwd1.value))
{
alert("Error: password must contain at least one number (0-9)!");
form.pwd1.focus();
return false;
}
re = /[a-z]/;
if(!re.test(form.pwd1.value))
{
alert("Error: password must contain at least one lowercase letter (a-z)!");
form.pwd1.focus();
return false;
}
}
else {
alert("Error: Please check that you've entered and confirmed your password!");
form.pwd1.focus();
return false;
}
if(form.mnum1.value != "" && form.mnum1.value == form.mnum2.value)
{
}
else
{ alert("Error: Please check that you've entered and confirmed your mobile number!");
form.mnum1.focus();
return false;
}
if(document.form.Country.selectedIndex=="")
{
alert ( "Please select a state!");
return false;
}
return true;
}
</script>
</head>
<body >
<form name = "form" action="./careers2.jsp" method="post" onsubmit = "return checkForm(this);">
<center><br><br>
<h2>First step Registration start</h2>
<br>
<center>
<table border="2">
<tr><td align="right">E-mail :</td> <td align="left"><input type="email" name="email1" required></td> </tr>
<tr><td align="right">Retype E-mail :</td> <td align="left"><input type="email" name="email2" required></td> </tr>
<tr><td align="right">Password :</td> <td align="left"><input type = "password" name = "pwd1" required></td></tr>
<tr><td align="right">Retype Password : </td><td align="left"><input type = "password" name = "pwd2" required></td></tr>
<!-- <tr><td align="right">Mobile Number : </td><td align="left"><input type = "tel" name = "mnum1" required></td></tr>
<tr><td align="right">Retype Mobile Number : </td><td align="left"><input type = "tel" name = "mnum2" required></td></tr>-->
<%
out.write("<tr><td align=\"right\">State :</td><td align=\"left\"> <select name=\"Country\" >"+
"<option value=\"Select\">----------Select State------------</option>"+
"<option value=\"Andaman and Nicobar Islands\">Andaman and Nicobar Islands</option>"+
"<option value=\"Andhra Pradesh\">Andhra Pradesh</option>"+
"<option value=\"Arunachal Pradesh\">Arunachal Pradesh</option>"+
"<option value=\"Assam\">Assam</option>"+
"<option value=\"Bihar\">Bihar</option>"+
"</select> </td></tr>"
);
%>
</table><br><br>
<input type = "submit" value = "Submit" class="button1"></center>
</center><br><br><br><br><br><br><br><br><br><br><br >
</form>
</body>
</html>