-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Can we make the error detail for textfields dynamic ? #1017
Comments
You can do this using the delegation methods associated with the TextField. There is not a validation check for the values added, at least not at the moment. It would be a good feature though, and has been noted prior. I will add a feature request tag to this and make a sample or build it into Material. Thank you! |
Just wanted to add my two cents 😄 Validation should live outside of the framework as there are too many types of fields and validations. Ideally you would have a protocol to enable such functionality. protocol TextFieldValidator { protocol EmailTextFieldValidator: TextFieldValidator {} Then you can conform to your protocol when you need to validate a specific field and implement the validateTextField signature. This also ensures that you keep your code dry and don't create needless subclasses of TextField. Let me know if this makes sense - otherwise I can make a sample. Best! |
I agree @adamdahan. Are you suggesting to leave this outside of Material for now? |
Made PR for this #1082 |
#1082 is merged in, so next release gonna have this feature. For the usage guide see the PR description. Thank you! |
I am going to close this issue as the PR is merged in. Let's focus on tomorrow making a release. |
When the user is typing email : If the email is not in Regex format then it should the error ("invalid") automatically and when the email is again edited in Regex format then the error must be removed automatically while editing. Is it possible to do using this library ??
Just like as shown in screenshots below for Email field :
The text was updated successfully, but these errors were encountered: