2

Could someone write me how to make a new line in error message in RegexpValidator in Vaadin?

I have method:

public TextField addPhoneNumberField(String value, String location, boolean readOnly) {
    final String PATTERN = "^[0][0-9\\s]*$";
    final RegexpValidator validator = new RegexpValidator(PATTERN, 
    "Phone number is not valid. Only numbers are allowed. Phone number must begin with zero");
    etc

I need have each sentence in new line. I tried to put there \n, \r\n, <br/>, but nothing is working.

Is it possible?

1 Answer 1

1

Simplest way (without extending Vaadin's client component VErrorMessage) is to use preformated text and use CSS rule for it.

For new line in java use: \n

And add style rule in used style.css file (example for all tooltip error messages):

.v-tooltip .v-errormessage {
    white-space: pre;
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.