Toggle switch value

Probably a simple question.
I have a toggle switch, and i want to ON CHANGE, UPDATE (supabase)column with the value of the toggle switch.

Where do I find this… (Initial state value is coming from the database)

Hi @Kawwl :wave:

Here’s a video on the topic: Video for Karl - toggle — Tella

I used the REST API plugin to demonstrate because that’s what I had in my project but the same logic would apply with the Supabase plugin :slight_smile:

2 Likes

Hey Joyce! First, thanks for the great video. I think i jumped the gun on my request. The plot thickens…

The toggle values is in a dynamic table, so maybe this needs more layers.

So initital state = item.toggle (== false).
When toggle switch on .item is switched then UPDATE supabase column to item.togglevalue.state.

BUT i just found the solution as well:
event.value (even though it is empty) setting that to the UPDATE call, actually changed the value accordingly… I was mislead by its empty state.

1 Like

I’d like to know how to bind toggle on a list to update value of field on table Supabase too.

Hey Hayttle,

You can use the On Change event on the toggle, then trigger supabase UPDATE. Send in the value through event.value. Event is empty when you look at it, but it will send true/false.

Funny to answer my own post from a few years ago.

1 Like

Not being able to see the event value is really confusing. I wasted almost a entire day trying to set up a kanban because I couldn’t find the event value — but it was there (invisible :joy:). The WeWeb team should fix that. @Joyce

Funnily, it does make sense. Because there is no value there :sweat_smile:

A trick if you don’t know what the event is, you can put a return at the top and check your logs to see what actually comes in the event.

Yeah, I agree it’s a very confusing UX. It trips me up fairly regularly as well :sweat_smile:
The product team is aware but hasn’t quite found the perfect solution (yet!)