Why doesn't jquery validation plugin's remote attribute work for me?
Posted
by Pandiya Chendur
on Stack Overflow
See other posts from Stack Overflow
or by Pandiya Chendur
Published on 2010-05-19T18:13:06Z
Indexed on
2010/05/19
18:40 UTC
Read the original article
Hit count: 199
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;
}
© Stack Overflow or respective owner