I using jquery validation plugin.
In my form i need to check whether the nick name is already in use or not.
For that they are providing remote key to make ajax call. For me the ajax call is working
correctly and returning true or false. But its allowing even if the returned value is false,
which should not happen.
My validation code looks like,
$(function() {
$("#myform").validate({
rules: {
fullName: {
required: true,
minlength: 5
},
nickName: {
required: true,
minlength: 4,
alphaNumeric: true,
remote: {
url: "NickNameChecker",
type: "post",
data: {
nickName: function() {
return $("#nickName").val();
}},
success: function(data) {
return data;
}
}
}
},
messages: {
fullName: {
required: "Please Enter Your Full Name.",
minlength: "Full Name should have minimum 5 letters."
},
nickName: {
required: true,
minlength: "Nick Name should contain minimum 4 letters.",
remote: "This nickname is already in use."
}
}
});
});
Any suggestions would be appreciative!!!
Thanks!
Solution:
The solution is in my code only.
I just removed the success part and tried. Its working great!
trueotherwisefalseremoteoption, but none of the examples I could find showed thesuccessoption being specified.