Answer the question
In order to leave comments, you need to log in
Does not check the text for blurring?
I made a condition for checking, but for some reason the final method only works, so you can send with 2 empty lines, but I need all three lines to be checked, what is the error?
if (textname.getText().length() == 0){
textname.setError("Заполните Пустое Поле");
}
if (textsoname.getText().length() == 0){
textsoname.setError("Заполните Пустое Поле");
}
if (texttel.getText().length() == 0){
texttel.setError("Заполните Пустое Поле");
}
else {
//и если все поля заполнены применить этот метод
Answer the question
In order to leave comments, you need to log in
Because your "else" only applies to the last if
Do this:
var errors = false;
if (textname.getText().length() == 0){
textname.setError("Заполните Пустое Поле");
errors = true;
}
if (textsoname.getText().length() == 0){
textsoname.setError("Заполните Пустое Поле");
errors = true;
}
if (texttel.getText().length() == 0){
texttel.setError("Заполните Пустое Поле");
errors = true;
}
if(!errors){ /* все поля заполнены */ }
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question