Hey,
Am a bit stuck, though nothing major, hope I can get some assistance. Can I show you these four functions:
Code:
function updateForm(element, msg) {
$(element).request({
onSuccess: function() {
$(element).disable()
alert(msg);
$(element).enable()
}
});
}
function updateSpryForm(form, msg, captcha) {
if(Spry.Widget.Form.validate(form) == true) {
if(captcha == true) {
verifyCaptcha(form, msg);
return false;
}
else {
updateForm(form, msg);
}
}
}
function verifyCaptcha(element, msg) {
$(element).request({
onSuccess: function(transport) {
if(transport.responseText == 0) {
alert('Your security code does not match');
}
else {
updateForm(element, msg);
$(element).reset();
}
}
});
}
function checkPass(element) {
$(element).request({
onSuccess: function(transport) {
if(!$F('currentPassword')) {
return false;
}
else if(transport.responseText == 2) {
alert('Your given password is incorrect');
$('currentPassword').activate();
}
}
});
}
On my form tag, I have an onSubmit and I add two functions to it:
Code:
<form action="configs/ajax_functions.php?settings=password" method="post" id="passwordSecurity" onsubmit="checkPass(this); updateSpryForm(this, 'Your password was changed. You have been logged out, please log back in with your new password', false); return false">
What I want, is for when submit is pressed, it first uses the
checkPass function, and if that returns the error alert, then nothing else happens. Currently, if the error alert appears, another alert appears confirming that all went well, and that's been generated from the
updateForm function, which is used in
updateSpryForm function.
Urm, hope I made sense, and didn't boggle you with too much code.
Look forward to a response.