diff flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java @ 562:9f16ac843dda

Introduced a client side validation before new user data are sent to the server - the range/location panel already implements this validation. flys-client/trunk@2097 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 09 Jun 2011 14:06:10 +0000
parents 137daff2c732
children 6ebe845a9d37
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Thu Jun 09 10:57:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Thu Jun 09 14:06:10 2011 +0000
@@ -120,6 +120,14 @@
         stepItem.setValue(f.format(steps));
     }
 
+
+    public boolean validateForm() {
+        return
+            validateForm(fromItem) &&
+            validateForm(toItem) &&
+            validateForm(stepItem);
+    }
+
     /**
      * This method validates the entered text in the input fields. If
      * there are values that doesn't represent a valid float, an error is
@@ -140,6 +148,10 @@
         Map errors     = getErrors();
 
         try {
+            if (v == null) {
+                throw new NumberFormatException("empty");
+            }
+
             double value = f.parse(v);
 
             errors.remove(item.getFieldName());

http://dive4elements.wald.intevation.org