# Complex form with multiple data type creation

**URL:** <https://forum.bubble.io/t/complex-form-with-multiple-data-type-creation/181779>\
**Category:** Database\
**Created:** [December 10, 2021, 3:24pm UTC](https://forum.bubble.io/t/complex-form-with-multiple-data-type-creation/181779 "2021-12-10T15:24:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cynthia.conrad](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@cynthia.conrad](https://forum.bubble.io/u/cynthia.conrad)\
**Post date:** [December 10, 2021, 3:24pm UTC](https://forum.bubble.io/t/complex-form-with-multiple-data-type-creation/181779/1 "2021-12-10T15:24:04Z")

</div>

Hello everyone,

I’m developing an app for myself where I can upload structured finance articles (that myself or peers write) and legal precedent/rules, the result being a highly specialized database for our profession members to seemlessly consult.

To this end, I am among other things structuring a form that will, once completed, generate two data types. I have simplified the description of my data structure to focus on the problem.

* * *

💻 **DATA STRUCTURE**

* * *

🟩 **Data type 1**  
**Field 1** : Text  
**Field 2** : Option set 1  
**Field 3** : Option set 2  
🟠 **Field 4** : List of Data type 2

🟧 **Data type 2**  
**Field 1** : Text  
**Field 2** : Option set 3  
🟢 **Field 3** : Data type 1

* * *

📰 **FORM STRUCTURE**

* * *

📗Question 1 // Text input  
📗Question 2 // Dropdown for option set 1  
📗Question 3 // Dropdown for option set 2  
📙Question 4// ADD ITEMS ➕  
🟠 _Question 4 List of inputs fields to fill per added item_  
_ **input 1** _ : text  
_ **input 2** _ : Dropdown for Option set 3

* * *

I understand that upon submission of this form, submitted data will populate two data types: 🟩Data type 1 and 🟧Data type 2.

Here are the two questions that came up as I was building:

* * *

_**I°)Form filling process: Question 4: Impacting only this form’s user’s added items to a repeating group that he can visualize as he types**_

* * *

The form user can add multiple items that each bear 2 inputs as explained in the Form structure.

_**1°)a- User interface / Adding a list of fields when filling out a form**_

* * *

This is very likely a question that has already been asked, but so far I am finding solutions on how to have a user pick out multiple items from a repeating group populated with preexisting data as an answer to a form question (applied to my app this would be 🟠Form question 4 ).

My objective is to allow a user to add a new item to 🟠Form question 4 by submitting his own unique inputs, for as many inputs as need be. If anyone has a link to a video or forum treating this functionality I would be ever so gratefull.

* * *

_**1°)b- User interface / Showing the list of added fields in a repeating group apparent in the form (prior to data submission)**_

It seems that I cannot have a repeating group unless I send the data to my database beforehand. The issue is that, first of all, I don’t want the data to be submitted yet, I just want the user to add inputs to this question and visualize what he has added, and move on to the next question of the form; but let’s assume that this cannot be done, and have a workflow create the new inputs in the data base when the user submits his new items, before he moves on to the next question: this data would be sent to 🟧 **Data type 2** as orphan data, since 🟩 **Data type 1** has not yet been created, thus no key to link. Therefore, my repeating group will not be able to discriminate all the other 🟧 **Data type 2** that may have been submitted either by this user or another, since 🟩 **Data type 1** key does not exist yet.

* * *

_**II°) One form submission button, multiple data type creation**_

* * *

Finally, I am wondering about how to go about with actually submitting all these data elements in a linked manner.

In other words, the clicking action of my Submit button is tributary of multiple workflows. I need to create **two new “things”** : some answers are to populate 🟩 **Data type 1** and some to populate 🟧 **Data type 2**.

Is there a best way of/best practice for doing this? Because I see various solutions to various problems but I’m not confident with patchworking my way out of this one.

I hope the problem was clearly exposed, and than you for any input!

Cynthia

---

<div class="post-metadata">

**Author:** ![adamhholmes](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/adamhholmes/32/100510_2.png) [@adamhholmes](https://forum.bubble.io/u/adamhholmes)\
**Post date:** [December 10, 2021, 3:47pm UTC](https://forum.bubble.io/t/complex-form-with-multiple-data-type-creation/181779/2 "2021-12-10T15:47:52Z")

</div>

There are probably various ways to approach this (some will require plugins), but here’s how I would do it…

For **datatype\_1** I would create a new thing only once the form has been submitted.

But, as you’ve already suggested, I would create a new thing for **datatype\_2** every time a User clicks the Add Item button, and store them in a custom state list. (if they cancel the form you can then delete them from the database. And you could also schedule a backend workflow to run after, say, 1 hour to delete them if they haven’t been attached to a **datatype\_1** ).

So, once the user gets to the stage of being ready to submit the final form, you’ll have already created several **datatype\_2** entries in the database, which are stored in a custom state on the page (although they won’t yet be linked to the **datatype\_1** as that doesn’t exist yet).

Then, when the form is submitted, create a new **datatype\_1** , add the **datatype\_2s** from the custom state list to the new **datatype\_1’s** list of **datatype\_2s** , then use ‘ **make changes to a list of things** ’ to modify the list of **datatype\_2s** on the newly created **datatype\_1** (or in the custom state list) and set the newly created **datatype\_1** to the each **datatype\_2’s**  **datatype\_1** field.

---

<div class="post-metadata">

**Author:** ![cynthia.conrad](https://avatars.discourse-cdn.com/v4/letter/c/3bc359/32.png) [@cynthia.conrad](https://forum.bubble.io/u/cynthia.conrad)\
**Post date:** [December 10, 2021, 3:53pm UTC](https://forum.bubble.io/t/complex-form-with-multiple-data-type-creation/181779/3 "2021-12-10T15:53:55Z")

</div>

ahA! I had a hunch that the solution was to be found in custom states - I’ve been procrastinating on diving deeper into those but I’m left with no choice ! 😂  
thank you so much for reading my (long) Q and replying, i’m going to test this out and I’m quite sure that your solution is the most rational one (as opposed to the messy way I was heading).

Best regards,
