Tasmanian Devil
06-22-2003, 08:14 AM
What did I do to this script?
<head>
<title>New User Login Screen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function validatePwd() {
var invalid = " "; // Invalid character is a space
var minLength = 4; // Minimum length
var pw1 = document.myForm.password.value;
var pw2 = document.myForm.password2.value;
// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your password twice.');
return false;
}
// check for minimum length
if (document.myForm.password.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}
// check for spaces
if (document.myForm.password.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
else {
if (pw1 != pw2) {
alert ("You did not enter the same password twice. Please re-enter your password.");
return false;
}
else {
alert('Thank you.');
return true;
}
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" background="clouds.jpg">
<form name="myForm" method="post" action="cgi-t/form.cgi" onSubmit="onsubmit=onSubmit="return checkPw(this)">
<p align="center"><b><font size="+3">
<input type=hidden name=from value="New User Login@foxvalleynews.com">
</p>
<table width="473" border="0" align="left">
<tr>
<td width="26%">First Name:*</td>
<td width="74%">
<input type="text" name="First Name:">
</td>
</tr>
<tr>
<td width="26%" height="22">Last Name:*</td>
<td width="74%" height="22">
<input type="text" name="Last Name:">
</td>
</tr>
<tr>
<td height="-4" width="26%">Address:*</td>
<td height="9" width="74%">
<input type="text" name="Address:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Apartment:</td>
<td height="9" width="74%">
<input type="text" name="Apart:">
</td>
</tr>
<tr>
<td height="-1" width="26%">City:*</td>
<td height="20" width="74%">
<input type="text" name="City:">
</td>
</tr>
<tr>
<td height="-1" width="26%">State:</td>
<td height="20" width="74%">
<input type='text' class='txt' name='State:' value='Wisconsin' onFocus='this.blur()' size=20>
</td>
</tr>
<tr>
<td height="-4" width="26%">ZIP:*</td>
<td height="9" width="74%">
<input type="text" name="Zip:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Email:*</td>
<td height="9" width="74%">
<input type="text" name="Email:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Home Phone:*</td>
<td height="20" width="74%">
<input type="text" name="Home Phone:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Work Phone:</td>
<td height="20" width="74%">
<input type="text" name="Work Phone:">
</td>
</tr>
<tr>
<td height="-1" width="26%">Password:*</td>
<td height="20" width="74%">
<input type=password name=password maxlength=12>
</td>
</tr>
<tr>
<td height="-3" width="26%">Verify Password:*</td>
<td height="9" width="74%">
<input type=password name=password2 maxlength=12>
</td>
</tr>
<tr>
<td height="15" width="26%">Secret Question:</td>
<td height="15" width="74%">
<select name="Secret Question">
<option value="Birth Place">Birth Place</option>
<option value="Mother's Maiden Name">Mother's Maiden Name</option>
<option value="Pet Name">Pet's Name</option>
</select>
</td>
</tr>
<tr>
<td height="-4" width="26%">Secret Answer:*</td>
<td height="3" width="74%">
<input type="text" name="Secret Answer">
</td>
</tr>
<tr>
<td height="-2" width="26%"> </td>
<td height="4" width="74%"> </td>
</tr>
<tr>
<td height="-1" colspan="2">* = Required <br>
You will be receiving an email within 2 - 3 business days confirming your
new login setup. After you login, you can update your information or can
have us stop your paper if your going on vacation.</td>
</tr>
<tr>
<td height="-1" width="24%"> </td>
<td height="20" width="76%"> </td>
</tr>
<tr>
<td height="20" colspan="2">
<input type=button onclick="this.form.submit(); self.close()" value="Submit">
</td>
</tr>
</table>
<div align="left"></div>
<p align="left"> </p>
<p> </p>
</form>
<p> </p>
<p> </p>
</body>
This form just submits and does not check for the passwords to match.
Thanks
Devil
<head>
<title>New User Login Screen</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE="JavaScript">
function validatePwd() {
var invalid = " "; // Invalid character is a space
var minLength = 4; // Minimum length
var pw1 = document.myForm.password.value;
var pw2 = document.myForm.password2.value;
// check for a value in both fields.
if (pw1 == '' || pw2 == '') {
alert('Please enter your password twice.');
return false;
}
// check for minimum length
if (document.myForm.password.value.length < minLength) {
alert('Your password must be at least ' + minLength + ' characters long. Try again.');
return false;
}
// check for spaces
if (document.myForm.password.value.indexOf(invalid) > -1) {
alert("Sorry, spaces are not allowed.");
return false;
}
else {
if (pw1 != pw2) {
alert ("You did not enter the same password twice. Please re-enter your password.");
return false;
}
else {
alert('Thank you.');
return true;
}
}
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" background="clouds.jpg">
<form name="myForm" method="post" action="cgi-t/form.cgi" onSubmit="onsubmit=onSubmit="return checkPw(this)">
<p align="center"><b><font size="+3">
<input type=hidden name=from value="New User Login@foxvalleynews.com">
</p>
<table width="473" border="0" align="left">
<tr>
<td width="26%">First Name:*</td>
<td width="74%">
<input type="text" name="First Name:">
</td>
</tr>
<tr>
<td width="26%" height="22">Last Name:*</td>
<td width="74%" height="22">
<input type="text" name="Last Name:">
</td>
</tr>
<tr>
<td height="-4" width="26%">Address:*</td>
<td height="9" width="74%">
<input type="text" name="Address:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Apartment:</td>
<td height="9" width="74%">
<input type="text" name="Apart:">
</td>
</tr>
<tr>
<td height="-1" width="26%">City:*</td>
<td height="20" width="74%">
<input type="text" name="City:">
</td>
</tr>
<tr>
<td height="-1" width="26%">State:</td>
<td height="20" width="74%">
<input type='text' class='txt' name='State:' value='Wisconsin' onFocus='this.blur()' size=20>
</td>
</tr>
<tr>
<td height="-4" width="26%">ZIP:*</td>
<td height="9" width="74%">
<input type="text" name="Zip:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Email:*</td>
<td height="9" width="74%">
<input type="text" name="Email:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Home Phone:*</td>
<td height="20" width="74%">
<input type="text" name="Home Phone:">
</td>
</tr>
<tr>
<td height="-2" width="26%">Work Phone:</td>
<td height="20" width="74%">
<input type="text" name="Work Phone:">
</td>
</tr>
<tr>
<td height="-1" width="26%">Password:*</td>
<td height="20" width="74%">
<input type=password name=password maxlength=12>
</td>
</tr>
<tr>
<td height="-3" width="26%">Verify Password:*</td>
<td height="9" width="74%">
<input type=password name=password2 maxlength=12>
</td>
</tr>
<tr>
<td height="15" width="26%">Secret Question:</td>
<td height="15" width="74%">
<select name="Secret Question">
<option value="Birth Place">Birth Place</option>
<option value="Mother's Maiden Name">Mother's Maiden Name</option>
<option value="Pet Name">Pet's Name</option>
</select>
</td>
</tr>
<tr>
<td height="-4" width="26%">Secret Answer:*</td>
<td height="3" width="74%">
<input type="text" name="Secret Answer">
</td>
</tr>
<tr>
<td height="-2" width="26%"> </td>
<td height="4" width="74%"> </td>
</tr>
<tr>
<td height="-1" colspan="2">* = Required <br>
You will be receiving an email within 2 - 3 business days confirming your
new login setup. After you login, you can update your information or can
have us stop your paper if your going on vacation.</td>
</tr>
<tr>
<td height="-1" width="24%"> </td>
<td height="20" width="76%"> </td>
</tr>
<tr>
<td height="20" colspan="2">
<input type=button onclick="this.form.submit(); self.close()" value="Submit">
</td>
</tr>
</table>
<div align="left"></div>
<p align="left"> </p>
<p> </p>
</form>
<p> </p>
<p> </p>
</body>
This form just submits and does not check for the passwords to match.
Thanks
Devil