Hi, Please advise, how it is possible to integrate DWR (Direct Web Remoting http://getahead.org/dwr/) into JQuery validation?
I need to validate if such username is already existed in database (ajax validation) I was trying to do it in this way: 1)create dwr function function isUsernameExisted(username){ var id = $j('#id').val(); DWRUserManager.isUsernameExisted(username, id, { callback:function(dataFromServer){ if(dataFromServer!="<c:out value="${SUCCESS_VALIDATION_MESSAGE}" / >"){ return true; }else{ return false; } } }); } 2) add new validation rule to jQuery validator jQuery.validator.addMethod("correctUsername", function(value, element, params) { return isUsernameExisted(value); }, "Please enter different username."); 3) register this validator to username field $j("#userForm").validate({ rules: { title: { correctUsername: true, } ..... But it doesnt work to me, because for jquery isUsernameExisted() function always returns 'undefined' because it doesnt wait while callback is executed. So, is it possible to add new validation method to jquery validator and make it capable for using my isUsernameExisted() DWR function ? Thanks, Taras