Closed JustinPierce closed 10 years ago
These styles are applied in order to maintain Bootstrap-ish look of the validation summary. I've created a simple JavaScript in order to make the behaviour of server side and client side (unobtrussive) validation the same. You can download it here. Notice that this helpers has more things, not only related to ValidationSummary. Please examine to see what is most useful to you. Let me know if this does not work for you for any reason.
I understand the issue is resolved. Closing issue.
By default, the ValidationSummary control renders the following HTML:
When I use jQuery Validate to perform client-side validation, the only part of the styling that changes is that
validation-summary-valid
becomesvalidation-summary-errors
. This works as expected.However, when I perform server-side validation, the
bmvc-3-validation-summary
is rendered with the classesalert
andalert-danger
:This combination of behaviors makes it difficult for me to style the summary consistently. If I style
.validation-summary-errors
to look likealert-danger
, then it looks correct during client-side validation, but I get an alert wrapped in an alert during server-side validation. I can work around it with some convoluted CSS, but it's starting to feel like I'm fighting against your library rather than working with it.At this point, I would prefer it if no additional classes were added to the summary in either case, so I can at least maintain control in both situations in the same way.