jquery-validation-unobtrusive icon indicating copy to clipboard operation
jquery-validation-unobtrusive copied to clipboard

No documentation

Open sunsande opened this issue 3 years ago • 4 comments

This is the least documented project in history. There isn't a single line of documentation.

sunsande avatar Aug 19 '22 15:08 sunsande

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): image

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!

ghost avatar Sep 02 '22 13:09 ghost

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):

  • How is the library used and initialized? => By loading both jquery-validation and jquery-validation-unobtrusive on a page.
  • What does it do by default? => Client side validation messages, based on the data-* validation attributes that are returned by .NET Core.
  • When / how does it run? =>?
  • How should you activate it for dynamically loaded forms? => You can call the $.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
    }
    

marklagendijk avatar Sep 05 '22 09:09 marklagendijk

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.

https://github.com/aspnet/jquery-validation-unobtrusive/pull/153/files#diff-7682608b44f7ec8d3e8ee99d54671b335ec57fd7cba3ff3eb4e8751234648820

shawnpaige avatar Sep 06 '22 14:09 shawnpaige

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.

TanayParikh avatar Sep 06 '22 17:09 TanayParikh