One Page to Add and Update?

I understand how to navigate from one page to another using a Link element or Go to page as a workflow action.

I would like one page that others link to or go to that will either add a new thing or update the thing passed to it. Since the page is defined as a type of the thing I want to add/update, I can readily do the update because a thing will be passed in.

However, I don’t know how to link/go to the page without providing an instance of the page type.

When I use the page to add a new thing, I won’t be giving it an instance of the thing’s type. I just want to tell the page, “hey, there isn’t any thing of the type you handle, so please get input from the user and add one.”

Is this possible?

How do other people create add/update functionality?

I don’t think it will help the discussion, but here’s a link to the app in development. The page in question is todo.

I think you’re editor is set to private.

I’m not quite sure what you’re trying to do - would be helpful to see it.


I have application rights set to Everyone can edit.

I’m not sure that seeing the app will be very enlightening since I don’t have much functionality in it yet.

I simply want to have one add/update page so I don’t need to have separate pages for adding vs. updating things.

@sridharan.s, try it again. I changed the format of the link in my post so it might work for you this time.

I’d say the way to handle this is through a conditional action that checks right before the navigate action.

That action would be: create a new thing only when a thing doesn’t exist. And the navigate action would use the result of this step as the data to send.

Actually… Typing this out… Maybe the best way is through 2 events with different conditions. When button is clicked and thing does exist > go to page and data to send is that thing.

When button is clicked and thing does not exist > create thing > go to page and data to send is the result of the previous step.

Thanks, @romanmg.

The main page has a repeating group with links and Go to page actions (I’m trying different techniques.) If the detail page is invoked from a thing in the repeating group, the obvious behavior in the detail page is to support updating.

There’s an icon under the repeating group with Go to page in its workflow. If it is clicked, there is no current thing to pass to the detail page so the detail page should be able to support adding a new thing. However, Bubble raises an issue with trying to Go to page without sending data.

With Bubble, is the common approach to create separate add and update pages?

Not necessarily required to have two separate pages to accomplish this, but by setting that target detail page to a type, you must have data to send to it.

My suggestion for that button outside of the RG would be to Create a New Thing first as step 1 and then navigate to the detail page as step 2 which sends the result of the previous step (the new thing just created). So when the user gets to the detail page, you have a blank record, but a record nonetheless.

If you want a detail page to handle both existing and new Things, this is one of the more straight-forward ways to do it because there is no getting around not sending data to that page. By creating a new thing right before the navigate action, it makes no visual difference to the user, but structurally, everything is set up to work.

Without really understanding what’s happening under the covers, this sounds potentially messy.

My understanding is that when you create a new thing, it is immediately saved, even if it’s empty. Is that correct?

If so, there’s the potential of leaving empty or incomplete things in the database if they’re created before being handed off to the detail page for being fleshed out. If there are data consistency rules that need to be enforced for things of a given type, it’s probable that sometimes new empty things will be created and abandoned in the detail page.

Am I making sense in the context of Bubble?

Yes, makes sense. There’s a solution for this.

When you create a thing, it does take a moment to save in the DB. In human terms, it seems nearly instantaneous, but in technology terms it takes a split second (or sometimes even a few seconds I suspect).

So, when you’re running the workflow, don’t reference the value in the DB that you just created as there’s a chance it won’t be in the DB when the following action runs. Instead, reference the item’s creation (when I assume happens in step 1) and reference it from the 2nd action (e.g., using the “result of step 1”). This way, it’s guaranteed to be available to the second action.

As for the page itself, Bubble seems to know that this ID was just created and doesn’t run into problems. I’m 90% sure that this is stable and guaranteed to work (but not 100%). So, I do recommend you try it yourself and just run it, say, 100 times and see if you run into any errors.

Hope this helps.


1 Like

Yes, you’re right. You do run the risk of a user abandoning the new thing on the detail page.

You could implement safe guards like a confirmation screen to let the user know something new is being created or making it present in a list somewhere. Without looking at your app, if this was a list of to-dos, you could add this new To Do task to a list that the user sees and mark it as a draft if it hasn’t been “completed.” This would give them the opportunity to delete it or come back to finish filling out details.

What I’m trying to get at is the high-level concept of needing to send something to a page that requires a Thing. It needs to exist first. So, if it’s a better UX and management process for you to have two separate pages to handle creation and editing, then do that. If you can structure the workflows and transparency with the user to have things created every time (if they don’t already exist), then do this - and I’ve seen it done well in a handful of apps.

One real-world example is like creating a new email before sending. When you click on “Compose” and then click away, you end up with a draft in your email account. What you could do when you create this new Thing is automatically assign it a draft status of some kind (or whatever the equivalent label would be). And these draft Things would be visible to the user so that they’re made aware of the “empty” items.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.