I would reccomend first to generate the DATABASE and it’s structure.
What kind of data you want to collect?
What should be included inside your database?
Every good website has always a running database in the background.
Let’s call your new DATABASE (where you will store process data of a specific multistepform or whatever) —> “STATUS-DB”
Now you first make some thoughts about, which data to collect and how to structure your database, regarding the FORM you will want to connect to this database.
If your database is running automatically at the end, will depend on your coding skills and your setup.
Let’s imagine you have a MULTISTEP-FORM somewhere on your page or site, where you ask USERs for specific data, after they have logged-in. But why they have first to log in? → Because you want to collect data for each user, so you have to know who is currently visiting your website → to fill your database with the right data for the right user.
Let’s say your FORM includes data like…
-first-name
-last-name
-age
-city
-service-1
-service-2
-service-3
Now again →
- User logs in → you get the USER-ID
- User fills out the FORM and submits.
- As soon as user submitted → a function starts collecting all data for this specific user and all the service-states (fullfilled or not fullfilled) → writing them immediatelly to the corresponding fields inside your database → for the specific user.
So that means, you will also need a USER-ID-FIELD inside of your CUSTOM database, to make sure the data will be written for the appropirate user.
- Submission → completed? → Database collected the data (SAVED).
But maybe the user did not complete the form, so still some services or what ever open ? → Even if the user now leaves the website → the data is already saved.
- When user comes back to complete all tasks → you have another function running to check if data already exists inside database → loading all content accordingly to the last STATE —> showing an already loaded FORM for the current logged-in-user. → Now user can complete the form and again so SAVE the current state of the entered DATA.
…and so on… and so on… and so on…
Like already before, i would recommend to work OBJECT-ORIENTED → that means you work as most as possible with OBJECTS… like shown here…
const status = {
os_criada: true,
servico_execucao; true,
and_so_on: false,
and_so_on: true,
and_so_on: false
}