DateTimePicker - only date or time selected

Hi,

using jmix 2.2, I have complains about working with date time picker. When only date or only time is selected and entity is saved then no validation warning is shown and that specific field is set to null.

I have requirement that some kind of warning or validation should be shown to user when this happens and it should prevent user to save entity.

I did not find any way to do that in jmix. All value events etc are fired after selecting both. So I was considering extending jmix component but as I am debugging it, I dont see a way how to do that. Maybe you can give me an advise or introduce this feature in future release?

Thank you,
Jakub

If entity field should always be not null add NotNull annotaion to it. Bean Validation :: Jmix Documentation

If entity field should be not null only in one screen add NotNullValidator to screen field Validator :: Jmix Documentation

Hi yarik1706,

Thanks for you reply, but requirement is little bit different.

It is in case when field is not required/mandatory. It can be null, but user wants to fill it for specific entity.

User will select only date, and forgets to select time, then he confirms screen with no warning or validation and it is saved ok, but datetime is null. Problem is he thinks now that date is filled but it is not. It is still null.

So idea is to add some warning when user fills only date/time.

I know it is kinda problem of user that he is not able to fill both fields and thinks its ok :slight_smile: . But true is it is not much user friendly and atleast some warning would be nice. Like “you filled one of this thing but you have to fill both or it will not be saved” . I already spent some unnecessary debugging time to only find out that datetime is not filled and it is because of this.

My second idea how to solve this problem is to set only time to default 00:00 and leave date part empty. But I think jmix does not offer this either.

Thanks for any more suggestions,
Jakub