Hello guys, I need your help. I’m currently trying to build a pros and cons list. You know the basic. User inputs a pro or con and this goes into a list. However, I want that list not be stored in the database til the user press “send”.
And I also need to know how to implement this. I tried using a repeating group that takes in the content of an input but it doesn’t work.
I really need your help here. If you know a tutorial or something that will be welcome.
Thank you very much in advance!
Are you saying that you would like the user to be able to create a tentative list of pros and cons, and then hits a button that creates multiple entries at once? This may be doable but will be significantly harder than creating one at a time. Creating (and deleting) simple database entries like that will be so quick that it would probably be better performing than what you are describing. If you would like, I can create an example for you so just let me know!
Also, please let me know if there is a specific reason why you would like the user to be able to create the list before saving anything to the database rather than creating the list one entry at a time.
This is a quick example I drew up to demonstrate what I was saying. Let me know if this helps. More complex things can also be accomplish like adding a field so that you can group different list items into separate lists.
Seconding @ryanellman’s and expanding.
If you want to avoid saving things in the database until you’re ready, you can use a state to temporarily hold a list of texts. (Actually, two state-based lists: one for pro, one for con).
However, you may find this is difficult for a few reasons:
- Bubble doesn’t immediately let you create a bunch of new database entries at once from a text list (without getting into API workflows).
- The actual workflow above would take some time to run, causing a lag for the user.
- If, for any reason the workflow fails (dropped connection, browser refresh, etc), you risk losing the user’s data (which isn’t very nice to do to the user).
Continuing with @ryanellman’s approach, you can have items created in a “draft” mode. So, when an initial pro or con item is created (and added to a list), your data type would include a flag (call is “is_draft” and set the value to default to “yes”). Then, when the user hits a button (call it “Save List”), you run a workflow on the relevant list(s) and update to “yes”.
So, if a user wishes to “delete” the list (or you want to clear it out on page load), you simply search for all the items that are is_draft = yes.
Dan (creator of LearnTo - 15+ hours of Bubble tutorials and live coaching)
Thanks a lot. Will do. I was about to do this but I thought that storing that info before sending the whole thing was an inefficient way of using a database.
I was basically trying to do a sort of array of cons and lists.
To answer your question: The main reason I wanted it this was that it’s part of a multi-steps process where a user sends a recommandation for a product. I didn’t want anything to be stored because the user might as well quit the process and the database is stuck with useless values.
Your idea and @dan1 's approach put the whole thing together. That’s what I wanted, with full explainations about the efficiency of the process.
Thanks a lot guys
Whoah I say “process” a lot!
I see where you are coming from. I wouldn’t get overly worried about adding too many entries to the database - it would be difficult to hit any sort of limit that would affect performance (inefficient searches are much more likely to cause this problem regardless of how many entries you have in the database - I may write a post on that topic soon because I was able to speed up a workflow that was taking 15 seconds to less than a second by improving my searches and will share what I learned).
However, if you want to prevent useless entries from showing up in the database because you don’t want users to see them or something like that, what I would do is follow @dan1’s advice and then design your user interface to not show draft lists and to also send reminders to users to finish lists that they left in an intermediate state (i.e. set up a group on the user’s page that is invisible unless they have a list where in_draft? is true that includes text asking them to either delete the list or finish it. You could also initiate an API workflow that will delete the list automatically after a certain amount of time unless the user finishes it). Let me know if you need help with the API workflow concept - it takes some getting used to but is a useful tool as your app gets more complex.
Thanks. About improving searches, I’d love to read a post on that matter!
As for the API workflow, I may need that in the future! I will let you know.
This topic was automatically closed after 70 days. New replies are no longer allowed.