How to save subthings of a thing

Hello everyone!

I"m creating an admin dashboard for creating forms within bubble. The form would have several pages. In my database there is a thing called “Form”, which has “Pages” - List of Pages. Every page is a thing byitself, so I have a thing called “Page”.

When the admin creates a form, he can add pages with different context to the form. Currently I can save the pages one by one and add to the list of pages of the form. But these pages are saved and added to form without explicitly clicking on “Save Form” button. I cannot store the pages just in a state which contains a list of pages, because it is difficult or maybe impossible to modify an element of a list which is stored in a state.
I want the admin to be able to get rid of the modifications if he leaves without clicking on “Save Form” button.

So when the user creates a page for the form but leaves without saving the form, then the page should not be added to the form. How can I achive this? I think there should be a common scenario for such thing.

You can adjust lists that are states of an element. Maybe this could work:

  1. Create a “list of pages” custom state. e.g. a custom state called “temporaryPages” on your “save” button or some element on your app. Make a workflow On Page Load to ‘set list’ of “temporaryPages” to ‘x form’s pages.’
  2. When the user adds a new page and clicks a button, create a new workflow to “create a new thing” (a new page).
  3. step 2 of workflow: set state of ‘temporaryPages’ to value: "SaveButton’s temporaryPages:plus item result of step 1 (create a new page…)

That way the user can add pages to the custom state, but not to the ACTUAL form. If the user leaves or refreshes the page, the custom state will be wiped and the form won’t be affected.

If the user wants to save the pages, simply add a final workflow for clicking some “save” button on the app that:

  1. when user clicks “save to form” button → make changes to thing (form) → change the “pages” value to “set list x’s temporaryPages”
1 Like

Thank you very much for your help.

What you said make sense to me. I have tried similar things but could not accomplish so far. I will try it again based on your description.
One issue I see with it, that what happens to the thing (“Page”) created, added to the state but after refresh it will be lost from the state but remains in database.
Should not such things ,like a page that does not relate to any forms, be deleted somehow?

Eventually it works, but the issue I’ve raised regarding unused things in database remains. I could not figure out an efficient way to handle them so far.