Reputation: 399
I have requirement like following.
In page for Employee record entree 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 by using multiple text field.
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.
For this requirement it was easy 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.
Upvotes: 0
Views: 1302
Reputation: 37033
you have to write a CustomField<List<String>>
for this. Implement the abstract methods and then override (get|set)InternalValue
read and spread the values into list of textfields (e.g. on set remove all textfields, add one for each item in the list and add an additional one for new ones and some add-button). then you can use this field to bind to your list.
Upvotes: 3