Verificacion login
Publicado por Alfonso (2 intervenciones) el 30/11/2017 09:08:23
Buenas necesito que me lance estos errores cuando no se cumplan las condiciones. Solo me lanza el primer error, una vez se cumpla esta condicion lanza el siguiente, ¿hay alguna forma de que me los lance todos los errores a la vez?
Este es mi codigo:
Este es mi codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
te boolean validateForm() {
String sValPass = etPass.getText().toString(), sValRepPass = etRepeatPass.getText().toString();
if (!sValPass.equals(sValRepPass)) {
etPass.setError(getResources().getString(R.string.error_RepPass_Pass));
etRepeatPass.setError(getResources().getString(R.string.error_RepPass_Pass));
return false;
}
else if (etUser.getText().toString().isEmpty()) {
etUser.setError(getResources().getString(R.string.error_EmptyForm));
return false;
}
else if (etRepeatPass.getText().toString().isEmpty()) {
etRepeatPass.setError(getResources().getString(R.string.error_EmptyForm));
return false;
}
else if (etName.getText().toString().isEmpty()) {
etName.setError(getResources().getString(R.string.error_EmptyForm));
return false;
}
else if (!Regex.REGEX_PASS.matcher(etPass.getText().toString()).matches()) {
etPass.setError(getResources().getString(R.string.error_REGEX_PASS));
etPass.setText(null);
etPass.setText(null);
return false;
}
else if (!Regex.REGEX_EMAIL.matcher(etEmail.getText().toString()).matches()) {
etEmail.setError(getResources().getString(R.string.error_REGEX_EMAIL));
return false;
}
else if (etSurName.getText().toString().isEmpty()) {
etSurName.setError(getResources().getString(R.string.error_EmptyForm));
return false;
} else {
return true;}
}
Valora esta pregunta
1