Results 1 to 4 of 4

Thread: [CLOSED] Validator is skipped when value is blank.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sencha User becevka's Avatar
    Join Date
    Oct 2008
    Posts
    53
    Vote Rating
    0
      0  

    Default [CLOSED] Validator is skipped when value is blank.

    Dear GXT team.

    I found such bug in TextField code (GXT version 1.2.4).
    During processing validateValue(String value) it checks whether value is blank and if blank values are allowed it returns that value id valid without any respect to field validator, that can, by the way, allow field to be blank in some special cases.

    Of course, there are a lot of possibilities to work it around, but I rather prefer to be sure - when I've added validator I want it to be called.

    Thanks a lot.

  2. #2
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    132
      0  

    Default

    This is by design and changing this would be a braking change and so cannot be done. GXT3 can maybe look into this.

  3. #3
    Sencha User becevka's Avatar
    Join Date
    Oct 2008
    Posts
    53
    Vote Rating
    0
      0  

    Default

    Why it will be hard to change it in such way?

    Code:
    if (length < 1 || value.equals("")) {
              if (allowBlank) {
                  if (validator != null) {
                      String msg = validator.validate(this, value);
                      if (msg != null) {
                        markInvalid(msg);
                        return false;
                      }
                   }
                   clearInvalid();
                   return true;
              } else {
                markInvalid(getMessages().getBlankText());
                return false;
              }
            }

  4. #4
    Sencha Premium Member
    Join Date
    Sep 2007
    Posts
    13,976
    Vote Rating
    132
      0  

    Default

    Because it is braking change. You can override it if you need it this way. We cannot introduce this in GXT 1 and also not in GXT2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •