arrays of fields or field groups
See original GitHub issueSupport for an array of fields, or an array of field groups would be very useful. Without this feature, there is no obvious way to collect a list of values/objects if the length of the list is indeterminate. Here a couple of example use cases:
1. Array of Fields
For example, a form that allows the user to upload an unlimited number of images, each image would be stored base64 encoded inside an array.
2. Array of Field Groups
For example, if a user needs to enter the name, surname and date-of-birth of each of their children, this would be stored in the model as:
[
{"name": "John", "surname": "Doe", "dob": "1999-01-01"},
{"name": "Jane", "surname": "Doe", "dob" "2000-01-01"}
]
A suggested implementation is to add [+] and [-] buttons to the form which would allow the user to add and remove an item in the array, or in the case of (2), clicking these buttons would add/remove a group of fields.
Support for this feature exists in Angular Schema Form (an AngularJS declarative form library). The feature is documented here and a demo is available here by choosing “Array” from the “Select Example” dropdown.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
thanks @donalmurtagh I’ll take a look and see how I can implement this.
@donalmurtagh see issue #39 which has a sample repeater field. While it’s not natively supported by a vue-formly package, it’s not too hard to implement. Gist is here