Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-522

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

    XMLWordPrintableJSON

Details

    Description

      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()));

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              funkattack Martin Funk
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: