Forum Academy Marketplace Showcase Pricing Features

Complex form with multiple data type creation

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.


:computer:DATA STRUCTURE


:green_square: Data type 1
Field 1: Text
Field 2: Option set 1
Field 3: Option set 2
:orange_circle: Field 4: List of Data type 2

:orange_square: Data type 2
Field 1: Text
Field 2: Option set 3
:green_circle: Field 3: Data type 1


:newspaper: FORM STRUCTURE


:green_book:Question 1 // Text input
:green_book:Question 2 // Dropdown for option set 1
:green_book:Question 3 // Dropdown for option set 2
:orange_book:Question 4// ADD ITEMS :heavy_plus_sign:
:orange_circle: 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: :green_square:Data type 1 and :orange_square: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 :orange_circle:Form question 4 ).

My objective is to allow a user to add a new item to :orange_circle: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 :orange_square:Data type 2 as orphan data, since :green_square: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 :orange_square:Data type 2 that may have been submitted either by this user or another, since :green_square: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 :green_square:Data type 1 and some to populate :orange_square: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

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.

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 ! :joy:
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,

1 Like