-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Design a better validation experience for MVC #8573
Comments
@ryanbrandenburg can you please investigate and come up with some cost for this work? Thanks! |
@danroth27 seems we rely on jQuery for our validation too, it's not just transitive because of Bootstrap dependency. |
@mkArtakMSFT Right, the main work item tracked by this issue is investigating what it would take to remove the jQuery dependency from our validation support. |
Given that our current validation support is built on jQuery validation, the way I would think about this issue is to take a fresh look at what our client validation support should look like. Is there a different validation library that we should consider using? Etc. |
The one option that seems to be most popular (and standards compliant) would be using the built-in HTML5 form validation. The problem there is that it would only work for client-side validation. As far as I can tell HTML5 form validation doesn't solve any server-side validation problems, and even if it did it would require a lot of changes to DataAnnotations. HTML5 also isn't supported on older browsers (IE9 was the example I found). In my opinion it's not worth the work that would be required to remove our dependencies here in the absence of a more unified vision about what value we can produce from re-working DataAnnotations. |
This issue is still unplanned?! wow.. |
@sanamhub I doubt this will ever happen. It seems obvious that Blazor is the new flavour-of-the-month UI framework at MS, and it has a validation story built-in. I doubt you can expect any enhancements on the MVC and Razor Pages side going forward - unless it happens as a byproduct of their work on Blazor. So, I suggest you look at alternatives. That's what I did since my comment on this issue more than 3 years ago. |
@jerriep What alternative are you using? |
@lonix1 I am using React for my frontends now, primarily because of the massive ecosystem of libraries and components. If you want to stay in the .NET world, I suppose Blazor is the proper alternative. If you are locked into using MVC/Razor Pages, then you should probably look at something like https://github.com/haacked/aspnet-client-validation, which I mentioned earlier in this thread - it seems well-maintained. |
It seems reasonable to continue iterating on https://github.com/haacked/aspnet-client-validation rather than reinvent a first-party equivalent. We still haven't shipped 1.0, so breaking API feedback is welcome. Need a nonzero testing story, too. Sponsors? 😁 #34777 was a great solution to #17412 (other than deleting
...with a link to docs that can be updated to reflect the current state of the art. That may eventually be "it Just Works™️ with jUV 5.x or I don't think anyone is surprised that updating jUV isn't a top priority for the team, but waiting on a perfect solution has thus far meant there's no solution (except reflection). A well-documented optional configuration seems like a great first step that can be mostly community-driven. |
Can we at least get jQuery removed from the template? Encouraging use of jQuery should be considered an active bad, in and of itself, at this point. Experienced web developers will have no problem using web standards or finding a replacement package (say, https://github.com/haacked/aspnet-client-validation). Novice developers are hindered in their growth by promoting the use of libraries that have been outdated for the better part of a decade. |
Any updates in this? |
There haven't been updates for over a decade; doubt that'll change. Use https://github.com/haacked/aspnet-client-validation instead. You can then toss out jQuery, jQuery Validation and jQuery Unobtrusive Validation. It's a drop-in replacement, works perfectly, is actively maintained, has more features, and is much easier to use. |
There's a great tutorial on how to use aspnet-client-validation here. Can anyone explain the cause of all the navel gazing here? Doesn't addressing this consist of nothing more complicated than updating the ASP Core project template to use a newer and better library that already exists? To me this comes across as the usual MS attitude of 'we aren't going to fix this because we are already working on something new' (Blazor?), which I think is the main reason why most developers choose to use frameworks written by anyone other than MS. |
@Neutrino-Sunset especially for identity templates |
#8573 (comment) covers the problem statement for this issue
Bootstrap 5 is removing it's dependency on jQuery: twbs/bootstrap#23586
This issue tracks investigating what removing jQuery as a dependency from ASP.NET Core would take.
We're going to split this work into two phases:
The text was updated successfully, but these errors were encountered: