Hi Jörn , 
This is exactly what I was looking for. I somehow missed this demo.

Thanks!
Jimmy G

----------------------------------------
From: Jörn Zaefferer <[EMAIL PROTECTED]>
Sent: Wednesday, May 02, 2007 2:06 PM
To: jquery-en@googlegroups.com
Subject: [jQuery] Re: JQUERY Validator - Serverside Validation 

Jimmy,
> Should I add an array error structs(fieldID, Message) to the JSON 
> Response, and use the ShowErrors method of the validator?
so far that is the recommended solution. You can see a reference example 
here: 
http://jquery.bassistance.de/validate/demo-test/ajaxSubmit-intergration-demo.html
The interesting stuff are these lines:

var v = jQuery("#form").validate({
        submitHandler: function(form) {
                jQuery(form).ajaxSubmit({
                        dataType: "json",
                        after: function(result) {
                                if(result.status) {
                                        v.showErrors(result.data);
                                }       
                        }
                });
        }
});

That assumes a response in this format for errors:

{'status': 1, 'data': {'password': 'Your password is wrong (must be foobar).'}}

And this response in the success case:

{'status': 0}

Let me know if you have any idea on how that could be easier to use. Or 
if you any issues implementing it.

-- 
Jörn Zaefferer

http://bassistance.de


Reply via email to