c# - How to show validation summary that corresponds exactly to the form submitted -


the same problem discussed in post: multiple forms in mvc view: modelstate applied forms.

i have followed along post , have several forms on same view, custom editor template, have created , registered custom model binder. here accompanying gist.

when use html.validationresultfor() helpers in passwordeditorviewmodel.cshtml editor template desired results:

<li class="error">@html.validationmessagefor(i => i.oldpassword)</li> <li class="error">@html.validationmessagefor(i => i.newpassword)</li> <li class="error">@html.validationmessage("passwordchangeerror.wrongpassword")</li> 

this code returns validation errors form i've posted.

on other hand when use html.validationsummary() helper in same editor template validation result propagated across forms despite fact i've posted one:

enter image description here

is normal behavior? or have missed in code?

when using @html.validationsummary, not remember posted, , submit button. way have handled in past having

<input type="submit" value="button1" /> @if (request["button1"] != null) {     @html.validationsummary() }  <input type="submit" value="button2" /> @if (request["button2"] != null) {     @html.validationsummary() } 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -