you asked for a code to clean&focus, so how can you say it does not work because the password is changed.
it has nothing to do with it. it's like complaning because it does not wash your car
Maybe you got me wrong.
Let's summarize once again:
This is the current peace of code:
<form method=post action="/~userpasschange" onsubmit="return validatePassword(this);">
<table>
<tr><td align=left><b><font size="4"><font size="4">New Password</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass1 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><b><font size="4"><font size="4">Type Password again</font></b></font></b><td><b><font size="4">: </font></b><span style="background-color: #000000"><input name=pass2 type=password style="font-size:10pt; font-weight:bold; border:1px solid #88f" size="20" ></span>
<tr><td align=left><font size="4">Click <a href="/">here</a> to return to HOME.</font><td align=center><input type=submit value="Change">
</tr></table>
</form>
It uses a java script called "validatePassword" to check that pass1 and pass2 match:
<script type="text/javascript">
function validatePassword(form){
if (form.pass1.value != form.pass2.value){
alert("Password mismatch: please enter again.");
return false;
}
return true;
}
</script>
It works fine. If pass1 != pass2 then there is a message box and the user has to enter the new password again.
But first the user must "clean" the fields pass1 and pass2.
Here it comes your hint and I modified the java code:
<script type="text/javascript">
function validatePassword(form){
if (form.pass1.value != form.pass2.value){
alert("Password mismatch: please enter again.");
return false;
from.pass1.value = "";
from.pass2.value = "";
form.pass1.focus();
}
return true;
}
</script>
Now the message box pops up but the password is ALWAYS changed, even if the pass1 != pass2 !
Is it clear now?
PS: Sorry for such a silly questions, but I'm not a java expert