protected boolean validate(Validator validator, Object form, BindingResult result, ZeroView view) {
boolean hasError = false;
validator.validate(form, result);
if (result.hasErrors()) {
for (Object o : result.getFieldErrors()) {
FieldError error = (FieldError) o;
if (!hasError && error.getCode() != null && !error.getCode().equals("")) {
hasError = true;
if (error.getCode().equals("typeMismatch")) {
view.setMessage(new Message("zero.msg.invalid_input", Message.MSG_ERROR, error.getArguments()));
} else {
view.setMessage(new Message(error.getCode(), Message.MSG_ERROR, error.getArguments()));
}
}
view.highlightField(error.getField());
}
view.getJson().element("popuperror", true);
return false;
}
return true;