Closed as not planned
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 :-)
Metadata
Metadata
Assignees
Labels
This issue impacts very few customersIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesThis issue represents an ask for new feature or an enhancement to an existing oneFeatures related to the Razor view engine for Razor pages and MVC viewsThis label is used by an internal tool