Brief question first: How can I show an upload error message in the same style of all the other input fields?
Details: Vaadin 14.1.5 offers an upload-element: https://vaadin.com/components/vaadin-upload/java-examples
I created an upload field with this code:
MemoryBuffer buffer = new MemoryBuffer(); Upload upload = new Upload(buffer); A failure message for too large file size is enforce by this line:
upload.setMaxFileSize(1); Translation is done with UploadI18N (see https://vaadin.com/api/platform/14.1.5/com/vaadin/flow/component/upload/UploadI18N.html ):
upload.setI18n(buildMyUploadI18N(Locale.GERMAN)); And with all the listeners I can receive and show error messages at server-side, e.g. for rejection:
upload.addFileRejectedListener(new ComponentEventListener<FileRejectedEvent>() { @Override public void onComponentEvent(FileRejectedEvent event) { Notification.show(event.getErrorMessage()); } }); This code works fine and the system shows a notification message to the user when the file to upload is too large.
But: this validation-message-behavior differs from what the user is used to: Red text next to the input field (see screenshot).
How can I show an upload error message in the same style of all the other input fields?


