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.
OnBegin is what you're looking for:
using (Ajax.BeginForm("Action", "Controller",
new AjaxOptions() {
OnBegin = "alert('Replace with validation logic.')"
}))
Something like this:
function onSubmitFeedbackBegin(context) {
if (uploading > 0) {
return false;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With