org.apache.wicket.extensions.yui.calendar.DateTimeField; doesn't validate
-------------------------------------------------------------------------

                 Key: WICKET-522
                 URL: https://issues.apache.org/jira/browse/WICKET-522
             Project: Wicket
          Issue Type: Bug
          Components: wicket-datetime
         Environment: $ svn info
Pfad: .
URL: 
https://svn.apache.org/repos/asf/incubator/wicket/trunk/jdk-1.5/wicket-examples
Basis des Projektarchivs: https://svn.apache.org/repos/asf
UUID des Projektarchivs: 13f79535-47bb-0310-9956-ffa450edef68
Revision: 534415

            Reporter: Martin Funk


Trying to circle in https://issues.apache.org/jira/browse/WICKET-500 this one 
popped up:
org.apache.wicket.extensions.yui.calendar.DateTimeField; doesn't validate

Down below is a patch of FormInput of wicket-examles that attaches a 
DateRangeValidator to DateTimeField.
With this patch only the current Date (or maybe not even that) should be valid. 
But the opposite is true, any Date seem to be accepted by the form.

The stacktrace in the debugger shows that 
DateValidator.onValidate(IValidateable validatable) is never called,
since validatable.getValue() in:
RangeValidator(AbstractValidator).validate(IValidatable) line: 79       
returns null.

Could it bee that the Validator is validating DateTimeField's value wereas it 
should validate it's DateTextField value?

mf



Index: src/main/java/org/apache/wicket/examples/forminput/FormInput.java
===================================================================
--- src/main/java/org/apache/wicket/examples/forminput/FormInput.java   
(Revision 534415)
+++ src/main/java/org/apache/wicket/examples/forminput/FormInput.java   
(Arbeitskopie)
@@ -19,6 +19,7 @@
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.Arrays;
+import java.util.Date;
 import java.util.List;
 import java.util.Locale;
 
@@ -49,6 +50,7 @@
 import org.apache.wicket.util.convert.ConversionException;
 import org.apache.wicket.util.convert.IConverter;
 import org.apache.wicket.util.convert.MaskConverter;
+import org.apache.wicket.validation.validator.DateValidator;
 import org.apache.wicket.validation.validator.NumberValidator;
 
 
@@ -96,7 +98,7 @@
                        add(integerTextField.add(NumberValidator.POSITIVE));
                        add(new RequiredTextField("doubleProperty", 
Double.class));
 
-                       add(new DateTimeField("dateProperty"));
+                       add(new 
DateTimeField("dateProperty").add(DateValidator.range(new Date(), new Date())));
                        // 
add(DateTextField.forShortStyle("dateProperty").add(new
                        // DatePicker()));
 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to