Checkbox submitting value as an array
Checkbox submitting value as an array
![nicontrols](https://secure.gravatar.com/avatar/5f176d4555f0f9bc7e4c4a0d362e19a6/?default=https%3A%2F%2Fvanillicon.com%2F5f176d4555f0f9bc7e4c4a0d362e19a6_200.png&rating=g&size=120)
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?
This discussion has been closed.
Answers
Turns out I needed to add