PDA

View Full Version : [CLOSED] Validator is skipped when value is blank.



becevka
27 Nov 2009, 4:27 AM
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.

sven
27 Nov 2009, 4:28 AM
This is by design and changing this would be a braking change and so cannot be done. GXT3 can maybe look into this.

becevka
27 Nov 2009, 4:57 AM
Why it will be hard to change it in such way?


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;
}
}

sven
27 Nov 2009, 5:03 AM
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