TheCandyman
Technical User
Ya, i know this is simple, but im not sure what i am doing wrong. I want to compare 2 text boxes, if they are not the same display error, clear boxes, and setfocus.
function ValidateForm(){
if (document.form1.pwd.value == document.form1.pwd2.value)
{
alert('The passwords did not match');
document.form1.pwd.value = "";
document.form1.pwd2.value = "";
document.form1.pwd.Setfocus();
return false;
}
}
<form method="POST" action="Password_create.asp" onsubmit="return ValidateForm()" id=form1 name=form1>
<table border="0" class="verdana11px" width="348" height="305">
<tr>
<td width="347" align="center" height="22">
<font size="2">Enter a Password</font>
<input type="password" name="pwd" size="15" tabindex="4"> </td>
</tr>
<tr>
<td width="347" align="center" height="22">
<font size="2">Confirm Password</font>
<input type="password" name="pwd2" size="15" tabindex="5"> </td>
</tr>
...
...
function ValidateForm(){
if (document.form1.pwd.value == document.form1.pwd2.value)
{
alert('The passwords did not match');
document.form1.pwd.value = "";
document.form1.pwd2.value = "";
document.form1.pwd.Setfocus();
return false;
}
}
<form method="POST" action="Password_create.asp" onsubmit="return ValidateForm()" id=form1 name=form1>
<table border="0" class="verdana11px" width="348" height="305">
<tr>
<td width="347" align="center" height="22">
<font size="2">Enter a Password</font>
<input type="password" name="pwd" size="15" tabindex="4"> </td>
</tr>
<tr>
<td width="347" align="center" height="22">
<font size="2">Confirm Password</font>
<input type="password" name="pwd2" size="15" tabindex="5"> </td>
</tr>
...
...