Save list items with toggle = true

Hello,

I’m trying to build a custom list with a toggle on each list item, where the user can select the items they wish to save and then click a button at the bottom of the screen to save the selected items.

I have a reference table that contains the list items in column 1 and “active” in column 2. The toggle toggles the active status true/false.

When I try to set up the save button, I cannot access the list items with active status = true to save the data into a log table. e.g. list item with timestamp recorded

Has anyone done this before? Any advice/steps would be much appreciated, thanks!

@freya you can use the toggle component itself to save the item to collection.

Along with the option to toggle, you now have additional actions option within toggle to save the record.

You’ll not need a save button anymore to do this.

Ohh and welcome to the community, happy building!

1 Like

@bhanu thank you for such a quick reply and warm welcome! :slight_smile:

I’m not sure that it quite works for what I’m trying to do or maybe I haven’t wrapped my head around it yet…

For example if I have a question with answers a, b, c, d, e, I don’t want the save active = true directly on that collection record where I have the list of options.

I’d like to save only the selected answers to a new record in a new table to keep a log and then reset active = false. I don’t want to keep overwriting them on the same record.

Then by looking at the log table I can see that at time X the user answered the question with options b,c and at time Y they answered with a,d.

So my log table looks like e.g.
time X, answers selected = {b,c}
time Y, answers selected = {a,d}

How would you recommend to do this?

@freya I think toggle is not right option here in that case.

The way I’d approach this would be to replace the toggle with a button and add action to the button to update a new collection with the selected items.

this way your original collection just stays as-is and a new collection will capture all the responses over a period of time for your recordkeeping.

I hope that is what you’re trying to achieve, let me know if it isn’t. :slight_smile:

@freya would the button + action setup work to save list items contained in an external collection (Airtable) to a new internal collection (same properties as external)? The goal is to allow Logged In Users to keep a list of Favorites from the external connection.

I’ve seen the video from Ben that seems to detail this, but it’s a bit hard to follow…

@NoCode81 yes, it’s possible, I did the entire application using Airtable external collections (except users)

Basically you are clicking on a button for an item in a list (external), the action you perform when you click the button is to add the information to an internal collection, since you’re currently accessing the list item, it’ll by default make all the fields of that item available for you to send elsewhere (in this case an internal collection)

Thank you @bhanu and @NoCode81

It’s still not quite what I’m looking for.

If the user accidentally clicks an option and then un-clicks it, I don’t want it to be saved to the new collection as part of the record.

The action button doesn’t allow me to remove the record and doesn’t have a way to indicate the active status to the user in the same way the toggle button does. Unfortunately, it’s not appropriate to have a + and - with a count to indicate whether or not it’s selected.

With the toggle button, when the user toggles ON, I can add the option to the new collection but when the user toggles OFF I can’t access the same collection to remove that entry.

Do you know of any other ways that you can select items and de-select items on a list (e.g. if you made a mistake) and then once done, save to a collection?

@NoCode81 Please could you share the link to the video you mentioned?

You still can do this, have 2 buttons one above the other.

First one to add to collections and second to remove from collections.

Set visibility rule for the buttons to show only when the respective state matches your collections record.

That way you’ll be imitating the toggle feature by using buttons or +, - icons.

With the remove button I can’t access the new collection entry to set an action to remove it from the new collection - that collection is not there as an option. I can only remove the “Active” status on the list collection but don’t have access to corresponding entry in the new collection.

Maybe I have missed something in the set up

Sorry @freya but I do not have a video on this. You may find the following video from Adalo helpful. It is still a bit confusing to me, as I’m trying to do something similar to you.

https://youtu.be/qL5ywpCOHvI

Thank you @NoCode81 ! This was helpful!

Finally getting there! :slight_smile:

A friend also helped out and I needed to set up a screen or modal with an action button to initiate a new record and then I can use the buttons to update the new record on the next screen. Now I can add and remove options to the record.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.