MVC 3 Make a change to an input id and still have the validation work? Multiple identical models in one view?

You need to tell the validation plugin to reload after changing the id's. Try calling this after you updated the input's IDs.

Up vote 0 down vote favorite share g+ share fb share tw.

I am attempting to have a multiple model input page where I have 4 iterations of a model in an input form. Problem here is that all of the inputs are given the same id/name in the html, so only the first set is validated. With javascript, I was able to modify the ids/names of the inputs, but then all of the data-val- attributes are cleared out (or not initialized).

Is there a way I can do this? It is rendered inside the form like this: foreach (LogEntry sub in entry. SubEntries) { @Html.

Partial("_ViewSubRow", sub) } But the ones that re made inside that partial don't seem to validate? Jquery razor jquery-validate asp.net-mvc-3 link|improve this question edited May 19 '11 at 19:18 asked May 19 '11 at 18:39naspinski3,61342962 100% accept rate.

– Nick DeVore May 19 '11 at 18:42 edited to show how it is used using partials – naspinski May 19 '11 at 19:18.

You need to tell the validation plugin to reload after changing the id's. Try calling this after you updated the input's IDs: $.validator.unobtrusive. Parse('#myForm')).

I also had to add in some validation through JS manually, but this got me headed in the correct direction. Thank you. – naspinski May 21 '11 at 12:13.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions