Add a mandatory mark (*) to TabSheet. - V.8

Hi everyone,

I’m taking part in a project (With Vaadin 8.X). I have a TabSheet with three tabs and I need to set a mandatory mark (for example an asterisk) to the tab when there are empty mandatory fields inside (which are bound from database) to warn the user that there are some fields which are mandatory to fill and removing that mark when the field is filled. I’ve done some research but I didn’t find anything.

Thanks in advance.
17753406.jpg

Please, could anyone helping me? I need to set a mandatory indicator in the tabsheet. It seems I only can set a caption and an icon but I need to set a red indicator for mandatory too.

Thanks

If you are using the Binder in the form you har on Tab, I think you can achieve what you are looking for by using validation status handler, which called when status of validation is changing, pseudocode:

  binder.forField(..)
    .asRequired()
    ...
    .withValidationStatusHandler(status -> {
       if (status.isError()) {
          ... change tab title include asterix ...
	   } else  {
	      ... remove the asterisk ...
	   }
    })
 .bind(..);