Editor - set default value of checkbox - unespected behavior.
Editor - set default value of checkbox - unespected behavior.
Tester2017
Posts: 145Questions: 23Answers: 17
Maybe I am overlooking something, but I always worked with false/true 0/1 unchecked/checked.
To set a checkbox default as checked I have to give as default value a 0. Every other value will uncheck the checkbox.
Is there a reason for this behavior?
This code will give a checked checkbox:
{
label: `Hide group:`,
name: `group.hide`,
def: 0,
type: `checkbox`,
separator: `,`,
options: [
``
]
},
And this an unchecked one:
{
label: `Hide group:`,
name: `group.hide`,
def: 1,
type: `checkbox`,
separator: `,`,
options: [
``
]
},
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I am sorry, forget my question as I indeed was overlooking something. In other words: I made a mistake and already found a solution for it.
For to let it work the way I wished I needed to change to code the following way:
Thanks for posting back - yes the
unselectedValue
option ofcheckbox
is the way to do this.Allan