Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

TUTORIALVaadin lets you build secure, UX-first PWAs entirely in Java.
Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Calling javascript synchronously by Enver Haase, 2 weeks ago
StringValidatorissue
I have a use case like below:
TextField senrcv = new TextField("Sender/Receiver");
senrcv.setMaxLength(11);
senrcv.addValidator(new StringLengthValidator("send Error", 4, 11, true));
senrcv.setRequired(false);
The problem is, when this field is empty, StringLengthValidator returns false and I see error. But, I'm saying that null value is OK, and field is not required.
First couple of lines fomr isValidValue method of StringLengthValidator
@Override
protected boolean isValidValue(String value) {
if (value == null) {
return allowNull;
}
But issue, value is empty string, not null, so it continue to the validation methods.
AM I missing something?
Last updated on
You cannot reply to this thread.