Why doesn't jquery validation plugin's remote attribute work for me?
- by Pandiya Chendur
I use jquery validation plugin and the remote attribute works with emailId but not with mobileNo?
var validator = $("#addform").validate({
rules: {
Name: "required",
MobileNo: {
required: true,
minlength: 10, remote: '<%=Url.Action("getClientMobNo", "Clients") %>'
},
Address: "required"
},
messages: {
Name: "please provide a client name",
MobileNo: {
required: "Please provide a mobile phone no",
rangelength: jQuery.format("Enter at least {0} characters"),
remote: jQuery.format("This MobileNo is already in use")
},
Address: "please provide client address"
},
A null value is passed to my controller action.. Any suggestion...
public JsonResult getClientMobNo(string mobno)
{
JsonResult result = new JsonResult();
string status = clirep.getClientMobNo(Convert.ToInt64(mobno));
if (status == "Mobile No already exists")
{
result.Data = false;
}
else
{
result.Data = true;
}
return result;
}