]> source.dussan.org Git - vaadin-framework.git/commitdiff
Fixes ticket #1867 (Error message in Form is empty if required field is empty)
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Thu, 3 Jul 2008 15:19:18 +0000 (15:19 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Thu, 3 Jul 2008 15:19:18 +0000 (15:19 +0000)
svn changeset:5038/svn branch:trunk

src/com/itmill/toolkit/ui/AbstractField.java

index 5d43a7d7280cc4493d91a66af9a8ed7f7bd5a030..af0108a1d787f127d317574af8590e18dab388ec 100644 (file)
@@ -109,7 +109,7 @@ public abstract class AbstractField extends AbstractComponent implements Field,
      * Required field.
      */
     private boolean required = false;
-    
+
     /**
      * The error message for the exception that is thrown when the field is
      * required but empty.
@@ -616,14 +616,14 @@ public abstract class AbstractField extends AbstractComponent implements Field,
 
         return true;
     }
-    
+
     /**
      * Checks the validity of the Validatable by validating the field with all
      * attached validators.
      * 
      * The "required" validation is a built-in validation feature. If the field
-     * is required, but empty, validation will throw an EmptyValueException
-     * with the error message set with setRequiredError().
+     * is required, but empty, validation will throw an EmptyValueException with
+     * the error message set with setRequiredError().
      * 
      * @see com.itmill.toolkit.data.Validatable#validate()
      */
@@ -729,7 +729,9 @@ public abstract class AbstractField extends AbstractComponent implements Field,
             try {
                 validate();
             } catch (Validator.InvalidValueException e) {
-                validationError = e;
+                if (!"".equals(e.getMessage())) {
+                    validationError = e;
+                }
             }
         }
 
@@ -1030,9 +1032,9 @@ public abstract class AbstractField extends AbstractComponent implements Field,
         this.required = required;
         requestRepaint();
     }
-    
+
     public void setRequiredError(String requiredMessage) {
-        this.requiredError = requiredMessage;
+        requiredError = requiredMessage;
         requestRepaint();
     }