-
Notifications
You must be signed in to change notification settings - Fork 56
Open
Labels
Description
If a server-side error is added using
ModelState.AddModelError(String.Empty, "Generic error submitting this form");
There is currently no "built in" way to display it. MVC's ValidationSummary helper works, but it's strange to mix with ChameleonForms (and I believe with two forms on one page, it breaks).
There are several reasons to have overall form validation:
- Generic exception/error handling
- Server-side security failure (eg: User doesn't have permission to save with the specific values entered)
There is a trello task for this but with no detail: https://trello.com/c/1XFS1dHq/157-html-validationsummary-that-doesn-t-suck. In particular:
- Define "Doesn't suck"
- Is there any insight into how this should be done?
eg:
@using (var form = Html.BeginChameleonForm())
{
using (var section = form.BeginSection("Errors"))
{
@section.ValidationSummary();
}
}
- How is the section rendered if there are no validation errors to show?
- Is there a way to suppress the section if there are no errors (eg, using something like
if (form.ValidationErrors.Count > 0)orform.BeingSection("Errors", hideIfEmpty:true);)? I'm not sure what the "ChameleonForms" way to do this.. - Should summary validation display only the non-field-specific errors, or should it also be able to display field-specific ones (like the MVC ValidationSummary helper can)?