Open sunsande opened 2 years ago
I came to the repo to find out what changed to make v4 - no docs.
For those in the same boat, I had to go digging in the pull requests (thankfully not too hard, but not ideal):
https://github.com/aspnet/jquery-validation-unobtrusive/pull/153/files
Still left having to assume that it was a breaking version because of the license changes. I could be wrong. No docs to tell me otherwise!
Sure, it is nice that this library is part of the default .NET setup etc, but when people actually visit this repo, they are usually looking for details. This repository currently still follows more the "it does what you want, trust me"-philosophy of .NET Framework, instead of the "you have full power and control"-philosophy of .NET Core.
Important details that are currently not documented (note: I answered most questions already, because I needed the answers and spend a couple of hours finding them):
jquery-validation
and jquery-validation-unobtrusive
on a page.data-*
validation attributes that are returned by .NET Core.$.validator.unobtrusive.parse
method:
$.validator.unobtrusive.parse($('.myForm'));
How can you check for form validity in your custom submit
handler?
=> You can ignore the submit
event for non-valid forms by returning true
at the top of the handler function:
$('.myForm').on('submit', function(event){
if(!$(this).valid()){
return true;
}
// Your custom logic
}
It is also curious that the library went to v4, but the actual JS file used by the majority of consumers only has changes in the comments/license.
Thanks for reaching out, this is technical debt we have within this repo. We're open to community contributions in this area to improve the documentation for this library.
This is the least documented project in history. There isn't a single line of documentation.