How to bind list of TextField to BeanValidationBinder

I have requirement like following.

In Employee Bean, there are 3 types of field Name, Phone Numbers and Address. User can enter 1 name and 1 address per employee but he can add multiple phone numbers.

So initially there will be only 1 text field for phone number but user can add more text field using button. So text fields for phone numbers can increase and decrease.

I am binding the fields with the fields name so for this requirement BeanValidationBinder was able to bind name and address, since there will only 1 entry. But for phone numbers I have to use list and I am unable to bind list of text fields to list of strings.

Is this is possible in vaadin 8. Could you please share the possible solutions.

I think for the moment the easiest solution is to create binder for all of Name, Address and all existing PhonesNumber’s. If the amount of the PhonesNumbers is changed, just recreate the Binder.

To add on to Rajesh’s initial question, we are creating dynamic text fields (adding or removing text fields ) in the form and these fields need to be saved into a List of Strings on save of the form. The form also has the ability to add/remove fields from this specific text field type. Can you please provide an example to do this with or without custom fields.
Thanks.

Hello, i have a similar problem here. I have an Employee entity and a list of Department entity checkboxes. Employee can belong to multiple departments. So my model is something like this:

@Entity
public class Employee extends AbstractEntity{
	private String firstName;
	.
	.
	@ManyToMany
    @JoinTable(
            name = "employee_department",
            joinColumns = {@JoinColumn(name = "employee_id", referencedColumnName = "id")},
            inverseJoinColumns = {@JoinColumn(name = "department_id", referencedColumnName = "id")})
    private Set<Department> departments = new HashSet<>();
}

Dynamically i add checkboxes into the form. As many checkboxes as the Department records in database.
I am using Vaadin 11 and my form implements CrudForm from the official sample. Is there a way to bind the set of departments into the checkboxes ?

can this be done with Vaadin 14? Wanting to bind a bean that has a list of something feels like such a common usecase. Can I put my List in some component that implements what the binder expects and implement the back and forth of the data in that component myself?
Or should one use a Grid with one column where one row is one element of the list which doesn’t get drawn?