"Switch" element to change boolean value

Hey guys - I understand how to work with checkboxes in conjunction with a submit button to change a boolean value in my database.

Now I’m trying to make it more user friendly and eliminate the “Submit” button. How can I use an input “switch” element to update the boolean value in the database (on/off) without using a submit button? I know it’s going to use the OnChange code somewhere, but if you can help me out with the actual code, I’d really appreciate it.

Basically what I need it for:

There are tons of user profiles on my website that are managed by the users. I want to give them the option of being able to log into their dashboard and be able to change if they want their profile listed in the main list of profiles or if they want it hidden/not listed. Basically a vacation mode. I want the switch element to be at the top of their “Edit Profile” page that they can easily click ON or OFF in real time without the need of a submit button.

The column in my database is titled profileStatus which is a boolean field.

How can I make this happen? Thanks in advance!

I appreciate it. I have over 900 lines of wix code I have already written. This one had me hung up. Will give it a shot. Thanks for taking the time to assist.