Sounds good to me, but I'm not knowledgeable or experienced
enough with all this to evaluate an approach.

The biggest concern I have, especially when it comes to logins
and validation, is that a person might have js turned off (although
my stats show that is a tiny amount, less than 1 percent of people
that visit my sites) and then not be able to login or successfully
input data with a js-validated form.

Rick




One of the long-term targets of the validation plugin is to generate as 
much of the client-side validation rules as possible based on the 
serverside rules, without additional ajax requests.

Until that is available in any form, you could use the validation plugin 
to display your messages (returned from your AJAX request).

See this demo: 
http://jquery.bassistance.de/validate/demo-test/ajaxSubmit-intergration-demo
.html

The relevant client code is this:

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

In that example, result.data looks like this:

{'password': 'Your password is wrong (must be foobar).'}

That way you can use the same setup for displaying both clientside and 
serverside validation errors. Useful?

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/



_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to