-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Custom validity on MDCTextfield #1018
Comments
I would also like this feature to be implemented. Looking at the foundation class the validity is being set on blur. A better implementation would be to have a property 'setValidity' that you can set yourself and another variable 'useNativeValidityChecking' that will be true by default and when setValidity will be called it will become false. So this will not break current implementations of the textfield. |
The valid variable is just a setter. The only way to implement a getter in the foundation would require the adapter to have a function hasClass and check for |
Should I submit a PR ? |
So, I'm having a MDCTextfield that is initialized automatically.
I want to validate it by myself and this can't be done with any pattern or max-/minlength attribute.
As far as I understood the documentation all that's to do is calling
setCustomValidity
with any string as a parameter, but after doing so the field isn't marked as invalid. getting the validation properties of the HTMLInputElement also doesn't show anything.Am I missing something out or is something catching and reverting the invalid status?
Just giving the
.mdc-textfield
the classmdc-textfield--invalid
is also not working because the field may get and lose it's focus afterwards again (i tested it without any focus changes, too).The text was updated successfully, but these errors were encountered: