Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RelativeDateItem has a bug with validators

    hello
    RelativeDateItem has a bug in it, where the validators doesn't operate correctly
    (show an error as if validation failed) if date picked relatively.

    Repro code: (class and surroundings removed for brevity)

    DynamicForm form = new DynamicForm();

    DateRangeValidator dateRange = new DateRangeValidator();
    dateRange.setMin(new Date());
    RelativeDateItem relativeDateItem = new RelativeDateItem();
    relativeDateItem.setValidators(dateRange);
    relativeDateItem.setValidateOnChange(true);
    relativeDateItem.setName("rdi");
    relativeDateItem.setTitle("Pick a date");

    form.setFields(relativeDateItem);
    form.draw();

    now pick a date relatively (e.g. N weeks from now) and you'll get an error

    i haven't been able to create a workaround as even the onChanged event isn't fired when date picked relatively (another bug in my opinion)

    p.s.
    I'm not sure if this is the place to report this, but i haven't been able to find anywhere else to put these

    Thanks,
    Nadav.

    #2
    bumping it up.... :)
    anyone ?

    Comment


      #3
      That definitely looks like a bug, they are logged at http://code.google.com/p/smartgwt/issues/list, since you have an easy, standalone, reproducible problem. Probably has something to do with not using getAbsoluteDate() in the validation

      Comment


        #4
        Hi
        thanks for your reply, i'll log the bugs there from now on.
        regarding the problem itself,
        that was my initial thought as well, but when i realized that
        onChange isn't fired upon selection of a relative date, i switched to thinking maybe selecting a date relatively doesn't change the value, even more, it invalidates it, so i would say that selecting a date relatively may even put a null value\invalidates the value...

        Nadav

        Comment


          #5
          I'd always post bugs first in the forums. I looked at the code more, getValue() uses getAbsoluteDate() so the validator should be getting it. But as you already pointed out, the issue is that is always getting a null value not an issue with the date conversion.

          Comment


            #6
            A fix is in for this - take a look at a recent nightly build

            Comment


              #7
              thanks!
              i'll take a look soon enough :)

              Comment

              Working...
              X