Skip to content

missing validation error message #196

@to-do42

Description

@to-do42

Describe the bug

If I bind a TwinColGrid to a vaadin binder and declare its value as required, then no message is shown if the constraint is not fulfilled. The required indicator is visible, but no message occured if the validation failed.

Also, with a custom validator, no error message is shown:

    .withValidator(new Validator<>() {
        @Override
        public ValidationResult apply(List<TwinGridDto> twinGridDtos, ValueContext valueContext) {
            if (CollectionUtils.isEmpty(twinGridDtos)) {
                return ValidationResult.error("data is required");
            } else if (numberOfDistinctGewerke(twinGridDtos) > 1) {
                return ValidationResult.error("more than one Gewerk not allowed");
            } else {
                return ValidationResult.ok();
            }
        }
    })

Expected behavior

The message set via asRequired("message") should be shown.

Minimal reproducible example

TwinColGrid<TwinGridDto> grid = new TwinColGrid<>(availableData)
    .withAvailableGridCaption("Verfügbare Leistungstexte")
    .withSelectionGridCaption("Zum JUMBO hinzugefügt")
    .withoutAddAllButton()
    .withSizeFull()
    .selectRowOnClick();

// grid.addFilterableColumn(...);

this.binder.forField(grid.asList())
    .asRequired("should not empty")
    .bind(JumboDialogDto::getLeistungstextJumbos, JumboDialogDto::setLeistungstextJumbos);

Add-on Version

3.0.0

Vaadin Version

24.7.6

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions