@@ -52,27 +52,6 @@ public class RegRequestValidator implements Validator {
|
||||
errors.rejectValue("fullName", "fullName.invalid.chars",
|
||||
"Name can only contain letters, spaces, hyphens and apostrophes");
|
||||
}
|
||||
|
||||
String[] nameParts = trimmedName.split("\\s+");
|
||||
if (nameParts.length < 2) {
|
||||
errors.rejectValue("fullName", "fullName.missing.parts",
|
||||
"Please enter both first and last name");
|
||||
}
|
||||
|
||||
for (int i = 0; i < nameParts.length; i++) {
|
||||
String part = nameParts[i];
|
||||
if (part.length() < 2 && part.length() > 0) {
|
||||
errors.rejectValue("fullName", "fullName.part.too.short",
|
||||
"Each name part must be at least 2 characters");
|
||||
break;
|
||||
}
|
||||
|
||||
if (!Character.isUpperCase(part.charAt(0))) {
|
||||
errors.rejectValue("fullName", "fullName.capitalization",
|
||||
"Each name part should start with capital letter");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void validateCompanyName(String companyName, Errors errors) {
|
||||
|
||||
Reference in New Issue
Block a user