views:

41

answers:

1

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 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.

+1  A: 

Sounds like you may want to implement a form of validation group:

http://tpeczek.blogspot.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.

MattC
I am getting error on one ValidationAttribute which I implemented cause its trying to validate 1st tab when I am on 2nd tab.I tried 2nd link here but it gives me error on return html.ValidationSummary(); "ValidationSummary is not defined".Any suggestion ?
Mathew