westonwalker / BlazorMinimalAPI

158 stars 26 forks source link

Dynamic form validation #3

Open ameyer117 opened 11 months ago

ameyer117 commented 11 months ago

Is there a way to emulate the behavior of jQuery unobtrusive form validation, where form field errors are removed dynamically when the user fixes the field values? This would eliminate the need to re-submit the form after making corrections for the errors to disappear, which I think is a better user experience. Nice work on this though!

tanczosm commented 10 months ago

This works exceedingly well if you are rendering form views: https://andrewlock.net/adding-client-side-validation-to-aspnet-core-without-jquery-or-unobtrusive-validation/

But that is only because razor views have a form helper available.. if the form helper existed in blazor to create the same markup then you could do all the validation client side with javascript instead of sending it to the server.