-
Notifications
You must be signed in to change notification settings - Fork 10.4k
Closed as not planned
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-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 onefeature-mvc-razor-viewsFeatures related to the Razor view engine for Razor pages and MVC viewsFeatures related to the Razor view engine for Razor pages and MVC viewsseverity-majorThis label is used by an internal toolThis label is used by an internal tool
Milestone
Description
In the documentation it says for the input tag helper:
Generates HTML5 validation attributes from data annotation attributes applied to model properties.
But if I have an property like this:
[Required]
[StringLength(10, MinimumLength = 5)]
[Display(Name = "Computer name")]
public string ComputerName { get; set; }
And then uses the input tag like this:
<input asp-for="ComputerName" class="form-control" />
It becomes generated like this:
<input class="form-control" type="text" data-val="true"
data-val-length="The field Computer name must be a string with a minimum length of 5 and a maximum length of 10."
data-val-length-max="10" data-val-length-min="5"
data-val-required="The Computer name field is required." id="ComputerName"
maxlength="10" name="ComputerName" value="">
There is no minlength and required attribute as expected. Also, the form tag is generated with the novalidate attribute which to my understanding disables HTML5 validation.
I’ve also tried to disable client-side validation. This removes the novalidate attribute on the form tag, but the minlength and required attribues is still missing.
To summary, is HTML5 validation supported as it mentioned in the documentation?
Issue 8573 is a bit related to this.
I’m asking only by curiosity :-)
nphmuller, ctorx, ezaca, IndigoHealth, XmlmXmlmX and 1 more
Metadata
Metadata
Assignees
Labels
affected-very-fewThis issue impacts very few customersThis issue impacts very few customersarea-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 onefeature-mvc-razor-viewsFeatures related to the Razor view engine for Razor pages and MVC viewsFeatures related to the Razor view engine for Razor pages and MVC viewsseverity-majorThis label is used by an internal toolThis label is used by an internal tool