10-12-2007, 02:25 AM
|
#2 (permalink)
|
|
The Reckoner
Join Date: Sep 2007
Posts: 437
Thanks: 22
|
Hi, try this function (add it with your others):
Code:
function validate()
{
try
{
checkPass(this);
updateSpryForm(this, 'Your password was changed. You have been logged out, please log back in with your new password', false);
}
catch (szException)
{
alert(szException);
}
// I'm assuming this is intentional?
return false;
}
Then replace the onsubmit event with the following code:
Code:
onsubmit="validate(); return false;"
Finally replace your checkPass() function with this revised one:
Code:
function checkPass(element) {
$(element).request({
onSuccess: function(transport) {
if(!$F('currentPassword')) {
return false;
}
else if(transport.responseText == 2) {
$('currentPassword').activate();
throw 'Your given password is incorrect';
}
}
});
}
WHat this does is when the onsubmit event is raised it will call the validate function. It will then try to run the checkPass function followed by the updateSpryForm function. If the checkPass function fails we trhow an exception, rather than using an alert and returning false (your already using return false and I didn't know if that is for a specific reason). I hope this makes sense and most of all works, im a little tired, it's 03:30 :o
__________________
Any fool can write code that a computer can understand. Good programmers write code that humans can understand.
|
|
|
|