MVC2 Client Validation isn't working when getting form from ajax call
Posted
by devlife
on Stack Overflow
See other posts from Stack Overflow
or by devlife
Published on 2010-05-23T14:06:58Z
Indexed on
2010/05/23
14:10 UTC
Read the original article
Hit count: 364
I'm trying to use MVC2 client-side validation in a partial view that is rendered via $.get. However, the client validation isn't working. I'm not quite sure what the deal is.
[Required(ErrorMessage = "Email is required")]
public string Email { get; set; }
<% using ( Ajax.BeginForm( new AjaxOptions { Confirm = "You sure?" } ) ) { %>
<%: Html.TextBoxFor( m => m.Email, new { @class = "TextBox150" } )%>
<%= Html.ValidationMessageFor( m => m.Email )%>
<input type="submit" value="Add/Save" style="float: right;" />
<% } %>
I'm not doing anything special to render the the partial view. Just putting the html into a div and showing it in a modal popup.
On a side note, does anyone know if it's possible to submit the form with client validation without a submit button?
© Stack Overflow or respective owner