Skip to content Skip to sidebar Skip to footer

Ajax.beginform Beforesubmit Event

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.

Solution 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:

functiononSubmitFeedbackBegin(context) {
        if (uploading > 0) {
            returnfalse;
        }
    }

Post a Comment for "Ajax.beginform Beforesubmit Event"