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.

Defining and array field?

See original GitHub issue

I am trying to define a fairly complex nested field set. Below is an example.
How do I define an array in the field definition?

const fields = [{
  name: 'someField',
  label: 'Some Field',
  rules: 'required|string'
}, {
  name: 'clients',  //  This need to be an array of clients.
  label: 'Clients',
  fields: [{
    name: 'title',
    label: 'Title',
    rules: 'required|string'
  }, {
    name: 'firstname',
    label: 'Firstname',
    rules: 'required|string'
  }, {
    name: 'surname',
    label: 'Surname',
    rules: 'required|string'
  }],
}];

example JSON:

{
  someField: 'value',
  clients: [{
    title: 'Mr', 
    firstname: 'John', 
    surname: 'Smith',
  }, {
    title: 'Mrs', 
    firstname: 'Susan', 
    surname: 'Smith',
  }],
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

12reactions
simon998yangcommented, Jan 9, 2018

Even it’s not straight-forward, is there a way to use Unified Properties to define an ‘array’ field? I’d like to use unified properties as i can keep all the info regarding one field in one place.

2reactions
Dakkerscommented, Jul 17, 2018

@foxhound87 is it possible? (regarding question above)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Arrays in C++
An array is a collection of elements of the same type placed in contiguous memory locations that can be individually referenced by using...
Read more >
Arrays - Software AG Documentation
Defining Arrays. In Natural, an array can be one-, two- or three-dimensional. It can be an independent variable, part of a larger data...
Read more >
Defining Arrays - TechDocs - Broadcom Inc.
An array is a structure that stores sets of data within a function. The contents of an array are available only as long...
Read more >
Arrays in Java - GeeksforGeeks
An array can contain primitives (int, char, etc.) and object (or non-primitive) references of a class depending on the definition of the array....
Read more >
Define Array Fields in the UI | Adobe Experience Platform
When defining an Experience Data Model (XDM) field in the Adobe Experience Platform user interface, you can designate that field as an array....
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