In MVC, is there a way to fire an onBeforeSubmit event when using Ajax.BeginForm? I'd like to validate some data on the client side and give proper feedback to the user.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
OnBegin is what you're looking for:
using (Ajax.BeginForm("Action", "Controller",
new AjaxOptions() {
OnBegin = "alert('Replace with validation logic.')"
}))
UPDATE
Something like this:
function onSubmitFeedbackBegin(context) {
if (uploading > 0) {
return false;
}
}