What is jQuery Validation Unobtrusive Native?
jQuery Validation Unobtrusive Native is a collection of ASP.Net MVC HTML helper extensions. These make use of jQuery Validation's native support for validation driven by HTML 5 data attributes. Microsoft shipped jquery.validate.unobtrusive.js back with MVC 3. It provided a way to apply data model validations to the client side using a combination of jQuery Validation and HTML 5 data attributes (that's the "unobtrusive" part).
The principal of this was and is fantastic. But since that time the jQuery Validation project has implemented its own support for driving validation unobtrusively (which shipped with jQuery Validation 1.11.0). The main advantages of using the native support over jquery.validate.unobtrusive.js are:
- Dynamically created form elements are parsed automatically. jquery.validate.unobtrusive.js does not support this whilst jQuery Validation does.
See a demo
- jquery.validate.unobtrusive.js restricts how you use jQuery Validation. If you want to use showErrors or something similar then you may find that you need to go native (or at least you may find that significantly easier than working with the jquery.validate.unobtrusive.js defaults)...
See a demo
- Send less code to your browser, make your browser to do less work, get a performance benefit (though in all honesty you'd probably have to be the Flash to actually notice the difference...)
This project intends to be a bridge between MVC's inbuilt support for driving validation from data attributes and jQuery Validation's native support for the same. This is achieved by hooking into the MVC data attribute creation mechanism and using it to generate the data attributes used by jQuery Validation.
State of the Union
This is basically a "done" project. Work is complete and I'm not aware of any missing pieces. I could port this to ASP.Net Core / MVC 6 when it ships but I don't have any immediate plans to. Never say never though.
Help is appreciated so feel free to pitch in! You can find the project on GitHub...