Can't you use remote validation? This code should work. $("#password").rules("add", { messages: { remote: "Invalid password." }, required: true, remote: { url: ".../UVServer/login.php", type: "get", data: { email: function() { return $("#email").val(); }, password: function() { return hex_md5($('#password').val()); } } } });
On Nov 15, 1:45 pm, sprach <bensprach...@gmail.com> wrote: > I am new to javascript, jquery and validator, but really see the > potential and am trying to use in a new application. I am having a > little trouble wrapping my head around the layers of callbacks. > > I have a simple login form that I want to validate, but want to send > an md5 encrypted password to the server. All of my validation works > until I try and submit the form. Here is the code snippet of the > validator submit handler: > > .... > submitHandler: function(form) { > > var pwd = $('#password').val(); // md5 encode > the password > md5pwd = hex_md5(pwd); > //$('#password').val(pwd); > > $.get('../UVServer/login.php','email='+$ > ('#email').val()+ '&password='+ md5pwd, > function(resp) { > if (resp == 'false') > { > // password didn't match > validator.showErrors({"password": > "Incorrect Password or Email Address!"}); > > return false; > } > form.submit(); // Password matched, submit > the form > > }) > > }, > ... > > The problem that I run into is that I cannot call form.submit() in the > anonymous call back that I use for the jquery $.get call. In the code > above, firebug claims that form.submit() is not a function. > > I have tried many work arounds but nothing seems to work. I don't > want to use the "remote" rule, because I don't want to pass the > unencrypted password to the server. > > Help greatly appreciated.