Where can I find an Example on how to validate combo-box "Required"

I want to validate that a required combo-box is filled in my form.

I learned that we can validate required TextFields with the following code:

	    		new StringLengthValidator(Messages.get("username.required"), 1, null))
	    			.bind(User::getUsername, User::setUsername);			

is there any similar implementation for ComboBox ? I’ll really appreciate if someone can leave a small example here.

Thanks :slight_smile:

You can add asRequired(Messages.get("username.required")) to your binder. Required says that the field needs to have a value. Validators validate the data once it has a value.


Thank you very much. That way worked well. Thanks