diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/AbstractField.java b/modules/web/src/com/haulmont/cuba/web/gui/components/AbstractField.java index b5768fe7b1..da263b8712 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/AbstractField.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/AbstractField.java @@ -37,7 +37,7 @@ public class AbstractField extends Abstra final ItemWrapper wrapper = new ItemWrapper(datasource, metaClass.getProperties()); component.setPropertyDataSource(wrapper.getItemProperty(metaProperty)); - component.setRequired(metaProperty.isMandatory()); + setRequired(metaProperty.isMandatory()); } public boolean isRequired() { diff --git a/modules/web/src/com/haulmont/cuba/web/gui/components/LookupField.java b/modules/web/src/com/haulmont/cuba/web/gui/components/LookupField.java index 60cc0754d4..03dd175b2b 100644 --- a/modules/web/src/com/haulmont/cuba/web/gui/components/LookupField.java +++ b/modules/web/src/com/haulmont/cuba/web/gui/components/LookupField.java @@ -28,4 +28,10 @@ public class LookupField public void setLookupDatasource(CollectionDatasource datasource) { component.setContainerDataSource(new CollectionDatasourceWrapper(datasource, true)); } + + @Override + public void setRequired(boolean required) { + super.setRequired(required); + component.setNullSelectionAllowed(!required); + } } \ No newline at end of file