Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Update component error
Hello, I created a custom table type and I added some validations setting the component error (user error).
The table is on a layout inside a form. On the first submit, the error shows properly, but I would like to handle more than one validations.
I attached an image to clarify my problem. The bottom error message is not updated.
Is that possible?
Appreciate any help
If I understand you problem correctly, you are using setComponentError method for Validation. This method requires an interface ErrorMessage. It has a following method , you can prepare your multi-error message as html.
public String getFormattedHtmlMessage();
Thanks for your fast reply.
I've forgot to mention that I'm using the version 6.8.8, I think I 'm not able to access that method.
What I'm trying to do, it's to update the "bottom message" dynamically. For example, I've got 2 validations (valid characters and length), I'd like to that depending on what I submit the error that shows up.
(The message that appears over the input is updated properly.)
In that case, won't it be better to use StringLengthValidator and addValidator on component?. or you can even write your own dynamic validator extending AbstractStringValidator class.
hope this helps.
Actually I'm using validators for every TextField inside the CustomTable. I've overwritten the validate method for the table, so each field is validated with the proper method (I also have a validation for the whole table).
I had to set the component error because the form's error message didn't show up...
I didn't find another way to do that
Hi, I finally was able to do it
I did what that link recommends, using a custom validation for the whole form.