-
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
Disabling validation #100
Comments
I'd say yes.
I don't think so. I'm pretty sure aspnet-client-validation/src/index.ts Lines 1030 to 1034 in 5008fe3
Better would be to actually remove that callback (trickier because we need to keep track of which event type it's listening to): aspnet-client-validation/src/index.ts Lines 1042 to 1049 in 5008fe3
We could also remove the form event listeners for forms without any remaining inputs: aspnet-client-validation/src/index.ts Lines 969 to 970 in 5008fe3
Would you also expect existing validation messages/summaries to be cleared? Or just leave them and allow submitting the form, as would be the normal experience with server-only validation? |
I just wanted to "disconnect" a form from the library. As you put it, to get "the normal experience with server-only validation". It's a good question though, I'm unsure what other people would expect. Practically though, if someone goes to the trouble of disabling validation for a form, it's reasonable to expect that it would be "reset" to it's original state, i.e. no existing messages/summaries. |
But its original state might have been server-side errors. 🤔 I think most straightforward would be for v.removeMessages();
v.remove(); (IMO a small but useful change to allow |
Oops, I missed that scenario, you are right! 😊 |
I've started working on this. Will open a PR soon. |
"soon" #110 |
For diagnostic and/or testing purposes we needed to disable the library once it's already loaded.
I tried this:
And this:
Both complete without error, but when I then interact with the form, and validation is expected to run, I get this console error:
Are
remove
andremoveInput
intended to be usable by callers (in which case have I made a mistake in how I'm using them)? If not, is there some other way to disable the library once it's loaded, or is that impossible (and the only option is not to run it in the first place)?The text was updated successfully, but these errors were encountered: