Skip to content
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

Validation error displayed at android.support.design.widget.TextInputLayout level? #43

Open
Narayane opened this issue Oct 11, 2016 · 1 comment

Comments

@Narayane
Copy link
Contributor

Hi,

I wonder if it is possible to annotate a TextInputLayout which contains a TextInputEditText with @notempty and use startLiveValidation mechanism in the same way than if I have annotated the TextInputEditText inside?

If not, is there any way to override default mechanism to set validation error at TextInputLayout level (the container) instead of annotated ui component (the content) to avoid this icons superposition problem?

Thanks.

@Narayane Narayane changed the title Validation error shown at android.support.design.widget.TextInputLayout level? Validation error displayed at android.support.design.widget.TextInputLayout level? Oct 11, 2016
@Narayane
Copy link
Contributor Author

A quick workaround to override default mechanism, extend SimpleToastCallback and override showValidationMessage() as this:

@Override protected void showValidationMessage(FormValidator.ValidationFail pValidationFail) { if (pValidationFail.view instanceof TextInputEditText) { final TextInputEditText vTextInputEditText = (TextInputEditText) pValidationFail.view; ((TextInputLayout) vTextInputEditText.getParent().getParent()).setError(pValidationFail.message); } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant