That's a very common bug that happens to people who load a partial view via ajax and that view has a model with DataAnnotation validators. When u load the View the validation stop working.
How to fix that?
$.get("url", function()
{
$.validator.unobtrusive.parse("#form-id");
});
@Mahmoud Moravej
I don't know if this is part of unobtrusive or not, but you can use
$("form").validate({
rules: {
textbox1Id: "required",
textbox2Id: "required"
},
messages: {
textbox1Id: "*",
textbox2Id: "omg you missed textbox2!"
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.