-
Notifications
You must be signed in to change notification settings - Fork 32
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
Make setDirty more clever #93
Comments
Hi @makepanic, that would mean that focussing and un-focussing an input element without changing it wouldn't mark it dirty, right? I think that's not great for UX - for example, you wouldn't immediately see required field validations anymore. |
I guess you're right that it doesn't make sense for all forms. For our case we have a form that takes focus and only validates when changing the value or once it's submitted. Required fields are visually marked and simply focus/blur isn't triggering the validation. I guess we can close this issue as it's possible to create a |
Alright - i'll leave the issue open for a bit anyway. If there's more demand for something like this we could consider adding an option. |
Right now setDirty always sets the
dirty
property totrue
.We could make it more clever to only
dirty
the form if the changesetisDirty
istrue
.This also helps to prevents validating the form when removing focus of a form that uses
autofocus
to focus the first input element.If you're fine with this solution, I could open a PR.
The text was updated successfully, but these errors were encountered: