Forum Academy Marketplace Showcase Pricing Features

How do I use my edit a thing page as a create a thing page?

My edit forms and create forms are extremely similar, but I can’t seem to figure out how to pass the thing into the page if one exists, or pass the parent thing into the page if a thing doesn’t exist yet. It seems that a page can only have one content type, and so cannot accept either a thing or a thing’s parent. Even if I could pass the parent into the page, I would assume that the defaults on the form fields would then be broken, since the thing does not exist yet. What should I do in this situation? Thank you in advance for your help!

1 Like

Will this help? In the answer below I explain how one can create a thing / edit a thing.

Hi Faiz, Thank you so much for your response! I would like to rephrase my question in the hopes that it may make a little more sense.

For example, I might have a database table full of people and I may want to create a new property for each person, let’s say I want to store the details of the car they drive. I create a new “Car” type and add a field to “Person” that is of type “Car”.

I create a gorgeous edit car page with a fabulous form to enter the details of the car. I can add the car’s year, make, and model.

Can I use this page for adding a car to a person AND for editing the person’s car? Or must I create a new page with an (almost) identical form for each use case? The problem I’m running up against is that in order to pass the car to the car page, I must make the car page of content type car, which stops me from creating an action to go to that page without an existing car.

Thanks again for your help!

One solution would be to have a way to search for persons on that edit page. Display the results in an ordered list with a button to add the person (Current Cell’s person) to the car you are editing. See the “Saving and modifying data” tutorial if you haven’t already.

You can use any kind of searches and objects in the edit page for a Car, you’re not limited to just car fields and searches. So your question is about 1. finding the right person for the car and 2. adding this person to the car.
Also check out the “Defining a field as a list of things” tutorial.

1 Like

Continuing the discussion from How do I use my edit a thing page as a create a thing page?:

I think I might know what @honey may be referring to:

When saving changes to a thing, there’s an option to “Create if the thing doesn’t exist” checkbox. The reference documentation says that

You can change this behavior clicking on this box. In that case, the action will be equivalent to ‘Create a new thing’, and use the changes as initial values

I’m not having success with mine, as a “create new thing”. I created a “view donor” page, that displays a donor’s detail, sent from another page. That works fine, however, rather than maintain an identical “view donor” and “add donor” page, I’d like to be able to use the “view donor” save button to create a new donor.

I follow the workflow, and it seems like it should work, but the entry doesn’t show up in the database.

Here’s my blank view form, which I’d like to create a new donor, if one doesn’t exist:
https://gmcwsa16auc.bubbleapps.io/version-test/viewdonor?debug_mode=true

If you want to see it with valid sample data (in which case “save” would make changes to an existing donor):
https://gmcwsa16auc.bubbleapps.io/version-test/viewdonor/1452665924696x388192923972383170?debug_mode=true

Thanks!

Rob

1 Like

We fixed this issue :slight_smile:

2 Likes

Hi, I was going to make a new post for this question but it seems like it’s relevant to this.

So, i want people to be able to create “listings” and of course, edit those same listing.

I have a new listing form that does everything i need it to, and i made an edit listing button. But i’m confused as to where that edit button should point.
Should i duplicate the “new listing” page and in the workflow have that button edit the listing?
Or should the edit button send to the same exact page as the “create a new listing page” and change the workflow to “edit a thing” and check “create if doesn’t exist” ?

yes you can copy the page or you can have a hidden group that appears when you press edit. or you could have a popup that appears with the edit inputs. many ways to do this. If you decide to use a hidden group, you can put it inside the group with the create new inputs and underneath it. then choose collapse element when hidden and animate it to slide up and down to give it a clean look. but like i said you can be creative in this aspect and do it any way you want.

1 Like

Yes, as above, there are many ways of doing it, and the “best” one will work cleanly with your UX. It depends where you are doing the “edit” from.

Instead of using “create if doesn’t exist” you could re-use the same page by having a pre-step on the create listing. So “New Listing” button > “Please enter a listing name” > Create Skeleton Thing > Edit page.

So your edit pages prefils from the existing data, in the “new” flow it will all be blank.

Sorry to resurrect this thread, but I’m trying to do this as well, and I don’t see that anyone has quite answered the question…

I have an edit page that I’ve got working, but I’d like to use it as a “new” page… the problem is that the edit page expects to have data dumped into it from something… the page before it, a form, etc. how do i tell it not to expect any data in the case of a new entry?

Couldn’t you, on page load, or whatever the workflow is that navigates to this edit page, create a new entry with all fields blank and send that entry to the page? Then that page is now editing the new, blank entry.

I think that’s similar to what @NigelG described last.


Gaby | Coaching Bubble

I did that at first, but I’m concerned that that will end up creating a bunch of blank entries.

Perhaps offer a “Discard” option that deletes the entry and navigates away from the page. Or prevent the user from navigating away if fields are left blank. If the page is altogether abandoned (browser closed, etc.), you could schedule a recurring bulk delete of empty entries (with Zapier) - though that might just create more work.

You could also have a default blank entry stored in your database, so that “create new” actually goes to this single blank entry, and have different set of fields visible based on whether it’s in edit mode or create new mode. That is, if create new, the fields don’t auto-bind to the default blank, instead they are mapped to a separate workflow that creates a new entry with user input (off a create button on this page or something ).


Gaby | Coaching Bubble

It either will or it won’t. Until you try you don’t know.

If it doesn’t … all good.

It if does … then you have an issue with your UX, so find out why people are abandoning and try to fix that. But at least you have some data to work with.