I have designed a user profile form, a long form which is quite complicated.
Before the user can submit and save it, the form needs to be validated.
Here is the question:
When the form is saved into the DB, there are multiple tables involved.
Now I would like to introduce a function called “Save Form” which internally doesn’t validate the form and just save whatever the user entered.
There are potential issues, such as:
Q1> How to save temporary data?
Q2> What should I do if the user saves the temporary data
without submitting the form and then quit.
This feature looks like the Draft feature provided by Gmail.
There are a couple ways you could do this. You could save it to a different table. You could also (probably more popular) save it to the same table as the completed profiles, but flag it as incomplete via a column for this purpose. This column could be named
complete. If the profile is not complete, it would be set to0orfalse. If it is complete, it would be set to1ortrue. You can then query based on it.You could then “validate” the data via whatever procedure is required and set the column to
1ortrueas needed.The answer above should serve this purpose as well.
If you need to reload the data and allow the user to continue filling out the incomplete form, you will need to get some sort of identifier for them to allow this. You could do this by setting a cookie, or by some sort of unique identifier they would enter at the top of the form – such as SSN, phone #, student ID #, etc (or a combination).
If you are looking for a feature like Gmail’s draft feature, you will need to implement some sort of AJAX call that automatically fire’s every X seconds/minutes to automatically save the data.