Checkbox submitting value as an array

Checkbox submitting value as an array

nicontrolsnicontrols Posts: 32Questions: 16Answers: 1

I feel like I'm being really dumb here.

I want a checkbox for my editor field. When the user ticks it, I want a number 1 to be sent to the database. When unticked it needs to be a 0.

I tried the following for my editor field:

                label: "Tickbox:",
                name: "tickbox",
                type: "checkbox",
                options: [
                   { label: '', value: 1 }
                ],
                unselectedValue: 0

When I look at the data in presubmit, I see that it sends the value as an array:

tickbox: (1) […]
​​​​​   0: 1
   ​​​​length: 1

How can I convert this to a number?

Answers

This discussion has been closed.