* @return True iff the paint method does not paint anything visible.
*/
public boolean isInvisible() {
- if (getMessage() != null) {
+ String msg = getMessage();
+ if (msg != null && msg.length() > 0) {
return false;
}
if (causes != null) {
}
}
- if (uidl.hasAttribute("error")) {
+ if (uidl.hasAttribute("error")
+ && !uidl.getBooleanAttribute("hideErrors")) {
isEmpty = false;
if (errorIndicatorElement == null) {
errorIndicatorElement = DOM.createDiv();
if (isRequired()) {
target.addAttribute("required", true);
}
+
+ // Hide the error indicator if needed
+ if (isRequired() && isEmpty() && getComponentError() == null
+ && getErrorMessage() != null) {
+ target.addAttribute("hideErrors", true);
+ }
}
/*
// required fields, as in those cases user is aware of the problem.
// Furthermore, non-required empty fields are obviously correct.
ErrorMessage validationError = null;
- if (isValidationVisible() && !isEmpty()) {
+ if (isValidationVisible() && !(isEmpty() && !isRequired())) {
try {
validate();