-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider adding highlight/unhighlight events #38
Comments
I’d accept a PR for them! |
Hi! I was looking for the same thing as we have wrapping divs where we want to set a class when the field is invalid. @haacked still up for a PR? Not sure when I can find the time but if I do in the near future, what kind of event would we want? CustomEvent on the form like the In our use case I think that the best option is a "global" event where we pass the validated field (element) as a argument and it's validation state.
Any feedback would be appreciated before I get my hands dirty =D Cheers! Edit: |
Suggest adding public aspnet-client-validation/src/index.ts Lines 1052 to 1054 in ab9ef9c
and here: aspnet-client-validation/src/index.ts Lines 1087 to 1089 in ab9ef9c
Bonus points for also extracting equivalent Usage would be: const service = new aspnetValidation.ValidationService(console);
service.highlight = function (input, errorClass, validClass) { ... };
service.unhighlight = function (input, errorClass, validClass) { ... };
service.highlightMessage = function (span, errorClass, validClass) { ... };
service.unhighlightMessage = function (span, errorClass, validClass) { ... };
service.highlightSummary = function (el, errorClass, validClass) { ... };
service.unhighlightSummary = function (el, errorClass, validClass) { ... };
service.bootstrap(); |
I would love to replace our jQuery ASP.NET validation with this, but I can't because it's lacking the highlight and unhighlight events that we rely upon.
They're part of jQuery Validation rather than Microsoft's jQuery Unobtrusive Validation, and they let you run extra code at the time a field becomes valid or invalid.
Our use case for this is that we need error messages to be replicated in an Error summary similar to ASP.NET validation summary as well as next to the field, and we need to prepend "Error: " to the page title when there is an error. These changes make error messages more accessible to assistive technology users.
Would you consider adding support for them?
The text was updated successfully, but these errors were encountered: