thyrlian/AwesomeValidation

Double Validation with different Error String

regifr opened this issue · 3 comments

can I use two or more validator in one TextInputLayout

validator.addValidation(this, R.id.tilEmail, RegexTemplate.NOT_EMPTY, R.string.err_email_null); validator.addValidation(this, R.id.tilEmail, Patterns.EMAIL_ADDRESS, R.string.err_email);

while the tilEmail is EMPTY the error just showing Patterns.EMAIL_ADDRESS with err_email not err_email_null

@regifr

  • Yes, it doesn't support multiple validations on one field. So in your case, the new one will overwrite the old one.
  • The idea is to wrap all validation rules into one Regex, and bind it with a field. And I've confirmed, Patterns.EMAIL_ADDRESS has already included validation for empty input. Thus you don't need RegexTemplate.NOT_EMPTY.

Hey @thyrlian , I think this needs to be addressed. Can you please guide me on how to do it, just a high level overview will also work.

Hi @krhitesh, as I mentioned, instead of having two independent regex, please combine the matching rules into one regex, which could fulfill the requirements from both.