-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Needs: DesignThis issue requires design work before implementating.This issue requires design work before implementating.area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one
Milestone
Description
Overview
The validation helpers in MVC are due for some usability and capability improvements. We added Tag Helper-based validation helpers in the last release but they didn't really expand on the feature-set of the helpers themselves. Specifically, we're talking about the HTML Helpers and Tag Helpers that are used to enforce and show form validation on pages, including server-side and client-side validation.
Ideas
- Address DateTime validation aspnet/Mvc#575 Improvements to DateTime validation
- Address Allow hiding ValidationSummary content when there are no errors aspnet/Mvc#2372
- Address ValidationSummary could provide some way to jump to the field that is wrong aspnet/Mvc#1469
- Address Different markup state for empty/no errors validation summary between server and client implementations aspnet/Mvc#3377
- Validation summary helpers should work better with client-side validation
- Hide validation errors once they've been fixed on the form
- Show new validation errors when form fields are modified
- Support applying relevant validation CSS class names via server-side & client-side validation to elements associated with a form field, along with the form field input and label elements themselves:
- Containing elements like
<div>or<li>, e.g.<div class="form-group field-validation-error">.... This makes it much simpler to style entire form fields based on their current validation state. - The
<form>element itself, e.g.<form class="form-horizontal form-validation-error" ...>. This makes it possible to style forms based on the validation state of the fields they contain. - This will make it possible to easily apply Bootstrap's Form Validation states styles to elements associated with a form field
- Containing elements like
- Support consistent tri-state CSS class names for validation states or all elements related to a form field. Currently, different class names are used to represent the three possible states of elements associated with a form field, e.g. "valid" for the
<input />and "field-validation-valid" for the<span>. Also, the<span>is never represented with the initial state (untouched by user) but rather always starts as valid. This can make it difficult to achieve certain form field styles. - Make it easier to style and/or render markup for form fields that are required that is separate to the required validation message itself, e.g. showing a "required" glyph next to form label or form input element:
- Support adding a CSS class on elements associated with required fields, e.g.
<label for="FirstName" class="control-label form-field-required">First name:</label>
- Support adding a CSS class on elements associated with required fields, e.g.
- Support easily adding custom markup associated with the validation state of form fields to allow for more interactive/informative field validation states, e.g. see the "With option icons" section of Bootstrap's form validation states documentation
- Support alternate form submission behaviors when form is invalid using client-side validation:
- Suppress submit until form is valid (the only mode available today)
- Disable submit button until form is valid
- Support initial focus:
- to first form field on page after document load
- to first invalid form field on page after document load (server-side validation)
- to first invalid form field on form submit (client-side validation) (this one already works I think)
- Support adding attributes and/or CSS class for form fields marked as read-only in model metadata (see Bootstrap support)
Metadata
Metadata
Assignees
Labels
Needs: DesignThis issue requires design work before implementating.This issue requires design work before implementating.area-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing one