Forum Academy Marketplace Showcase Pricing Features

Programming an Undo Button

Arguably the most important function ever created from user stand point…

Has anyone had any success programming this in to their app? For instance if you have a button that deletes something in the database, it is hit accidentally…thank god for UNDO!

I imagine this feature would is not currently available, and may take major work on Bubbles backend - but wanted to make sure I wasn’t missing something.

I’ve tinkered with it for certain things, like making changes to my user profile or something. The way I’ve done it is by visually making the change using conditions, then upon some other event (like the undo button disappearing), I’ll actually make the change in the DB. It’s kinda like how Google Inbox lets you “undo” deleting a message, but it’s not a blanket undo for everything.

1 Like

This is something that you can implement. Just maintain a history of changes and when the undo button is pressed, retrieve the latest event and revert it.

3 Likes

Can you bring back something that was deleted from the database?

You can mark something as deleted but not actually delete it from the database.

1 Like

@Scott - A history of changes…would it be a history for each thing in your DB that might change…once the change happens on the original thing, record the change in the “history thing” of that thing?

It really comes down to the design of your data. You are free to maintain it on the object or not, depending on how you want to interact with it when saving the “delete” and performing the undo action.

1 Like

Ok I think I’m starting to catch on…what @potentialthings is saying is, at first, the disappearance of the data is visual (with a conditional) - then upon some other confirmation of the user not wanting to change it (navigating to another page perhaps), then the real delete happens.

In my specific situation, the delete happens in a repeating list which displays all the data in my database to the user…not sure off the top of my head if that condition trick would work with a “Current Cell”

A couple of approaches come to mind (overlap with some of the prior ideas mentioned).

  • Time-delayed delete: User clicks a button on the repeating group to delete an item. This schedules an API workflow to delete said item X second in the future. (Apply some sort of fade conditional state to give the user content).

  • Marked for Deletion Field: apply a yes / no criteria when the user clicks Delete option. Have the repeating group only display active data (ie. not marked for deletion). Apply an additional API workflow to remove marked for deletion data if you see fit.

  • Utilize a changes log: when a workflow is run that deletes/updates the data, have a corresponding log item created that references the state of data prior to the update. Then have an “Undo” workflow that references the corresponding record to undo the mistake.

2 Likes

@potentialthings, @Scott, @dan1 - Thank you all for your input on this - it helped me and I think provides a good reference for this topic in the forum. That being said, I’m going to mark @dan1 comment as the solution because it provides a good summary of the possibilities discussed in this thread.

Thanks again.

1 Like

@cschrade thank you, I appreciate it :slight_smile:

1 Like