Quick question, working with some switches, if I set the custom value to 1 - as I believe is correct, does this just mean by default the value when the switch is ‘on’ is 1, not the default off value?
So to explain my self better.
Static value on a switch = 1
Switch by default is off = value of 0
User switches on = value of 1
User switches back off = value returns to 0
And if I want to set a dynamic value (e.g. when a user returns to the page, they see their pre-existing settings) will this cause issues if I am also using the ‘static’ value?
Thank you for this Ben, but neither of these talk to how the static and dynamic values work for these in Wappler when used in work flows. If you have any advice around this, that would be great.
I’ll also try and find some docs re checkbox value as you recommend as that may lead me to the answer
Switches, being actually checkboxes won't send any value when they are off/unchecked. The value set for it (static or dynamic) will only be sent when it's checked.
There are few approaches to use switch. The easiest IMHO is by setting your database default value to 0 then the checkbox static value to 1. If user checks the switch it will input 1 into the database. If not then your database value will be default to 0. You can use dynamic attribute : checked when the database value == 1.