aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/itmill/toolkit/ui/AbstractField.java
diff options
context:
space:
mode:
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>2008-07-03 15:19:18 +0000
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>2008-07-03 15:19:18 +0000
commit4c59a7035b247b070e0ab919b2773029e66f2e72 (patch)
tree0cebfdfe2ea984d4705b8470adb4262cc5bbd455 /src/com/itmill/toolkit/ui/AbstractField.java
parent31041b24522260dee37afa13aa70404cb36d9e49 (diff)
downloadvaadin-framework-4c59a7035b247b070e0ab919b2773029e66f2e72.tar.gz
vaadin-framework-4c59a7035b247b070e0ab919b2773029e66f2e72.zip
Fixes ticket #1867 (Error message in Form is empty if required field is empty)
svn changeset:5038/svn branch:trunk
Diffstat (limited to 'src/com/itmill/toolkit/ui/AbstractField.java')
-rw-r--r--src/com/itmill/toolkit/ui/AbstractField.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/com/itmill/toolkit/ui/AbstractField.java b/src/com/itmill/toolkit/ui/AbstractField.java
index 5d43a7d728..af0108a1d7 100644
--- a/src/com/itmill/toolkit/ui/AbstractField.java
+++ b/src/com/itmill/toolkit/ui/AbstractField.java
@@ -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();
}