Hello i am creating an advance search form where an Ajax.Beginform is called from jquery with the .submit() event, the Ajax.Beginform returns a partialView and update a div on the page. Now when i press the search button the first time everything works fine and the page is updated properly but when i try to press it again the the form is never submitted and controller action is never called. When i checked firebug i found this error showing in the console every time i press the search button:
NB: i am using MVC5 and jQuery Javascript Library v2.1.3
注意:我正在使用MVC5和jQuery Javascript Library v2.1.3
2 个解决方案
#1
If you not need auto validation then remove "~/bundles/jqueryval" bundle.
如果您不需要自动验证,请删除“〜/ bundles / jqueryval”包。
#2
ok i found out what it was i had set some validation rules that are affecting the functionality once i removed them everything works fine now
好吧,我发现它是什么,我已经设置了一些影响功能的验证规则,一旦我删除它们现在一切正常
$("#ClientName").rules("add", {
required: true,
messages: {
required: "Client Name can not be empty."
}
});
$("#ClientLastName").rules("add", {
required: true,
messages: {
required: "Client Last Name can not be empty."
}
});
$("#ClientCompanyName").rules("add", {
required: true,
messages: {
required: "Company Name can not be empty."
}
});
i use them for another page but MVC uses default naming so i had a kind of conflict.