Multi-value (one-to-many) support for checkbox field type

Multi-value (one-to-many) support for checkbox field type

cbtdevcbtdev Posts: 39Questions: 12Answers: 0
edited August 2016 in Editor

Does the checkbox field type support multiple values? If so, what should my data look like and how should I implement the editor field?

Here is what my data looks like:

"data": [
    {
        "dashboards": [
            {
                "id": "101",
                "name": "Dashboard 2",
            },
            {
                "id": "100",
                "name": "Dashboard 1",
            }
        ],
        "description": "this is a test",
        "id": "3900",
        "linkOrder": "1",
        "newWindow": "false",
        "text": "Test",
        "url": "www.google.com",
    }
]

Here is my field implementation:

{
    label: "Dashboard(s)",
    name: "dashboards",
    data: "dashboards",
    type: "checkbox",
    options: [
        {name: "Dashboard 1", id: 100},
        {name: "Dashboard 2", id: 101}
    ],
    optionsPair: {label: "name", value: "id"}
},

Since my source object belongs to two dashboards, I would expect both checkboxes to be checked when I edit the record. However, none are checked. Is this even possible?

Thanks,
Kurt

This question has an accepted answers - jump to answer

Answers

  • cbtdevcbtdev Posts: 39Questions: 12Answers: 0

    Took a while to find it but I figured it out from this example.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    It doesn't explicitly support multiple values for an individual entry (i.e. a single checkbox has multiple object properties). I have a sneaky feeling it might actually work, but it isn't something tested for.

    Allan

  • cbtdevcbtdev Posts: 39Questions: 12Answers: 0

    It actually worked perfectly!

    Thanks!

This discussion has been closed.