开发者

ASP.NET MVC Client-Side Validation with a JavaScript Loader

Has anyone tried using MVC client-side validation with a JavaScript loader, specifically yepnope.js? I can't get it to work, and I believe it's because it registers the validation code before the necessary JS files have loaded.

I can get it working by loading jQuery, j开发者_JAVA技巧query.validation, MicrosoftAjax, and MicrosoftMvcValidation normally (i.e., outside of yepnope), but I wonder if anyone has a better solution. Thanks.


on the completed event of the YepNope please execute the below script where formName will be the name of your form.

  $(formName).removeData("validator");
  $(formName).removeData("unobtrusiveValidation");
  $.validator.unobtrusive.parse(formName);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜