User input for true and false

I’m doing a form where I require a user to either check the box or switch and be able to use the value in the code editor.

I am using checkboxes and switches but either way (on or off, selected or not) I get the same value. I want to obtain a true or false accordingly but not to make the field mandadtory.

Hi,
You can use Radio Buttons instead for the same purpose. You can set it as required using the settings button (optionally).

Good luck!
Tal.