element as an array in Editor

element as an array in Editor

NettSiteNettSite Posts: 36Questions: 11Answers: 2

Hi,

I would like to have elements of an array as individual fields in an Editor form, for example in HTML:

<input name=meta[employees].....>
<input name=meta[billing_period].....>

I have tried

                {
                "label": "Employees:",
                "name":  "meta[employees]" 
                }
                        
               {
                "label": "Billing Period:",
                "name":  "meta[billing_period]"
                }

and that looks like it may be working in the form HTML source:

<input id="DTE_Field_meta[employees]" type="text" class="form-control">
<input id="DTE_Field_meta[billing_period]" type="text" class="form-control">

but this is what is submitted:

data[bda3a4a9-ba6a-11e7-a5d8-d8fee360fa7f][meta]:weekly

As you can see, only the value of the last element of the "meta" array is submitted as if "meta" was an ordinary text field.

Is this possible with Editor?

Answers

  • allanallan Posts: 63,464Questions: 1Answers: 10,466 Site admin
    "name":  "meta.employees"
    

    should do it. Its not really an array as such in Javascript, but rather an object, and Editor supports nested objects as shown in this example.

    Allan

This discussion has been closed.