This is a migrated thread and some comments may be shown as answers.
MVC3 remote validation not working
4 Answers 79 Views
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Chris Foster
Top achievements
Rank 1
Chris Foster asked on 24 Mar 2011, 11:22 AM
Remote validation does not appear to work.  I have attached a sample project to demonstrate the problem.

The validation action is being correctly fired but no error is displayed and the save or insert is allowed to continue.

Please note that I have already downgraded jQuery to 1.4.4 to overcome the validation bug with jQuery 1.5.

Any help would be greatly appreciated.

4 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 24 Mar 2011, 02:42 PM
Hi Chris,

Unfortunately, I was unable to recreate the discrepancy you have described using the provided sample. Please take a look at this screencast which captures sample's local behavior and let me know if I'm missing something.

Also note that there is already newer version of jquery.validate plugin which is compatible with jquery 1.5.1.

Regards,
Rosen
the Telerik team
0
Chris Foster
Top achievements
Rank 1
answered on 24 Mar 2011, 05:03 PM
Hi Rosen

Thanks for your prompt reply!  I was very surprised to see it working and even more surprised to find it was now working on my machine.  After some further investigation I have found that it must be a timing issue.  This can be confirmed by adding a Thread.Sleep to the validation action as follows.

public JsonResult MustEqualTest(string mustEqualTest)
{
    System.Threading.Thread.Sleep(200);
    return mustEqualTest == "Test"
        ? Json(true, JsonRequestBehavior.AllowGet)
        : Json("MustEqualTest must equal test.", JsonRequestBehavior.AllowGet);
}

It appears to fail on anything over 100ms.  My real world validation is making a call to the database to perform the check and may exceed this timeout.

I didn't seem to be able to get jQuery validation 1.8 working with remote validation.

Kind regards

Chris

0
Accepted
Rosen
Telerik team
answered on 25 Mar 2011, 10:25 AM
Hello Chris,

Indeed, I was able to observed the issue. However, we have managed to address it. I have attached a modified version of grid.editing.js. I have updated your telerik points too.

All the best,
Rosen
the Telerik team
0
Chris Foster
Top achievements
Rank 1
answered on 25 Mar 2011, 11:32 AM
Great! Thanks again.

Chris
Tags
Grid
Asked by
Chris Foster
Top achievements
Rank 1
Answers by
Rosen
Telerik team
Chris Foster
Top achievements
Rank 1
Share this question
or