Two Forms on one page MVC
I am having jQuery tab control and first tab has a edit form and other tab is where users can upload images.Problem is that开发者_JAVA技巧 when I am on second tab and try to upload image it always validates the first form also.
First tab Edit Form:
<% using (Html.BeginForm()) {%>
Second tab Form:
<% using (Html.BeginForm("UploadImage", "Images", FormMethod.Post, new { enctype = "multipart/form-data" })) {%>
Is there a way to fix this so it only does post to Images controller instead of validating the 1st form.
Sounds like you may want to implement a form of validation group:
http://tpeczek.com/2010/06/partial-forms-validation-in-aspnet-mvc.html
http://www.pagedesigners.co.nz/archive/2009/07/15/asp.net-mvc-ndash-validation-summary-with-2-forms-amp-1.aspx
might be of help.
精彩评论