Beginner issue: Can't get client side validation to work
See original GitHub issueI can’t get RequiredIf validation in my ASP.NET MVC 5 application to fire on the client (it always posts back to the server).
I added the following to Application_Start
DataAnnotationsModelValidatorProvider.RegisterAdapter(
typeof(RequiredIfAttribute), typeof(RequiredIfValidator));
DataAnnotationsModelValidatorProvider.RegisterAdapter(
typeof(AssertThatAttribute), typeof(AssertThatValidator));
and my page contains the script reference to: expressive.annotations.validate.js
I get the correct validation error messages, but it always posts back to the server to get them.
Thanks for any help; I appreciate it.
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
asp.net mvc client side validation not working?
For some reason the Html helpers does not have generated validation attributes in the inputs (data-val="true" and the others), check that.
Read more >Client-side form validation - Learn web development | MDN
So why do we insist on validating our forms? There are three main reasons: We want to get the right data, in the...
Read more >Part 85 Enable client side validation in asp net mvc - YouTube
Otherwise, client side validation will not work. ... validation does not work, but server side validation will continue to work as normal.
Read more >Adding client-side validation to ASP.NET Core, without ...
In this article I describe how to use the aspnet-client-validation library to provide client-side validation instead of relying on jQuery.
Read more >When client and server side validations occur, doesn't it ...
I find a problem on the MVC4 project I am working on now, using Fluent Validation, in that some validations are delegated to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
As your generated scripts section shows, jquery.validate.js and jquery.validate.unobtrusive.js are loaded twice. Remove that redundancy and check then.
Good it works 😃 Regards.