开发者

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

开发者 https://www.devze.com 2023-04-09 03:19 出处:网络
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 ne

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

精彩评论

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