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);
精彩评论