ASP.NET Ajax.BeginForm Posts Even If Validation Fails
Posted
by Acoustic
on Stack Overflow
See other posts from Stack Overflow
or by Acoustic
Published on 2010-04-24T20:51:33Z
Indexed on
2010/04/24
20:53 UTC
Read the original article
Hit count: 951
I'm just overlooking something simple... but my form, which is an Ajax form, always submits even if the validation fails. I'm not using jQuery validation, just the standard .NET MVC validation.
Each of the field failing get show the validation message and highlight the field, but the form just submits anyway.
Is there an OnBegin script I can call to prevent the form from submitting if there are errors?
Thanks for the help!
Ajax.BeginForm("EditUserProfile", new AjaxOptions { HttpMethod = "Post", OnComplete = ToggleViews", UpdateTargetId ="userProfileContainer" })
© Stack Overflow or respective owner