question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

arrays of fields or field groups

See original GitHub issue

Support 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:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
matt-sanderscommented, Jan 18, 2018

thanks @donalmurtagh I’ll take a look and see how I can implement this.

1reaction
matt-sanderscommented, Nov 14, 2018

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Groups objects in arrays for a specific field - Stack Overflow
After merging two arrays of objects, I get an array structured like this. I would like to group objects with the same ID...
Read more >
Field Groups - ACF Extended
It allows developers to display custom data after the Field Group render on Post/User/Term/Options Pages Edit screen. /* * ACFE Render Field Group...
Read more >
Field Groups - Sanity.io
Organize your content editing experience by grouping fields together under tabs.
Read more >
Register fields via PHP - ACF
This article will discuss how to register fields and field groups via the ... Best to use the ACF UI and export to...
Read more >
Multiple Groups - Carbon Fields
Unique name of the group. ... Numeric array of fields. ... Each call to add_fields( $name, $fields ) creates a new group and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found