If you use @NotNull constraint then UI component will become required and requiredMessage will be set using message from @NotNull if it is connected to a datasource with that property.
Why do you call setValidationGroups for BeanValidator? It passes {Default, UiComponentChecks} groups to Validator by default.
What I want is that if the user does not enter data in the fields marked as required in the UI, then he will be shown the message that these fields are missing to fill when he tries to save the information, even though he has the fields marked as Required, try to save and I get an exception error by trying to save records in the table without information being required fields.
If you use standard Editor then standard validation will be triggered automatically on editor close / commit. Do you use standalone editor or Master-Details template?
Could you attach a small demo that illustrates the issue?
Hi, thank your for this topic. We have found an issue in our Entity Browser/Editor template - this template does not generate validateAll call in save method. Now you can use a workaround, just add condition to your save method:
public void save() {
if (validateAll()) {
getDsContext().commit();
Client editedItem = clientDs.getItem();
if (creating) {
clientsDs.includeItem(editedItem);
} else {
clientsDs.updateItem(editedItem);
}
clientsTable.setSelected(editedItem);
disableEditControls();
}
}
It will automatically perform all necessary validations and show validation errors in a Tray notification.