-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Is HTML5-validation supported? #20717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This is not yet support. |
Wow, that's really hard to believe. Open for 2 years. |
The dependence on a jQuery library for client validation in 2022 is quite concerning mainly as it's very legacy, performance, accessibility, etc. Vanilla JavaScript itself has come a long way and even GOV.UK have scrapped jQuery fully for native JS. Regardless, validation can be done fully without JS nicely. All modern browsers have built in HTML5 validation which is really simple to use and works natively. https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation It's just a matter of switching the tags that are added to forms inputs (asp-for) to the HTML5 replacements. Stuff like Some HTML5 attributes like maxlength are already added. ( Internet explorer is EOL and not something that has to be considered anymore. I don't think this would be a difficult thing to do and it'd modernise .NET Core a lot. |
We are going to use #8573 to track work in this area. As for HTML5 validation specifically, we do not think it is a good fit as we identified some gaps compared to the current experience the last time we evaluated it. |
@javiercn what are those "gaps"? From a browser developer's standpoint, I'd be interested in learning about those. |
@denschub I would need to dig into the details (we had this discussion many months ago and the developer on point is no longer part of the team), but I believe some of them were:
Some of these might be possible (even though at the expense of writing code), but in general html5 validation works very differently from our current validation system and we would like to maintain backwards compatibility where possible. |
Understood, yeah. There's probably some things you can already do with native APIs. For example, an Error summary could be built by iterating over form elements and reading None of that won't help with full backwards compatibility, of course. I was just curios, so thanks for the feedback! |
In the documentation it says for the input tag helper:
But if I have an property like this:
And then uses the input tag like this:
It becomes generated like this:
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 :-)
The text was updated successfully, but these errors were encountered: