Saving half forms for a particular user

Hi community! I am new to this forum and I apologise in advance if I am unintentionally breaking any rules.

I am creating a website which has a form that has to be filled by the user. But, what I want to do is, if the user fills any information in the fields of the form, that should be saved for the user so that, if he decides to refresh or for some reason logs out, his data is still saved and he can continue filling the form from where he left.

I was initially thinking of creating a separate database for this but I am kind of lost as of how to approach this. I would gladly take any passive or active help in this.

Keep in mind that no data is sent from the browser automatically. One of two things needs to happen for the server to even see the data:

  1. The user clicks some button allowing the form to be POSTed back to the server.
  2. Some JavaScript running in the browser sends the form data to the server.

If you don’t want the user push some button to save the partial form, you could write some JavaScript that detects when a form field has changed, and then send that changed field back to the server.

As far as saving the form in the database, there are any number of different ways of handling this - some of the choices being dependent upon how many forms this needs to be done with.

If it’s just one form, I’m not sure I’d make a whole separate database for this. I would just create a “partial form” model used to store the data-submitted-so-far - and then use the contents of that table when the form is being requested for rendering.

1 Like

I am not that familiar with JavaScript to do these type of things but that definitely seems interesting and I will look into that.

Yeah, after looking into the requirements clearly, I’ve also come to the conclusion that a separate model would suffice.

Thank you for your insight. That certainly helped me a lot.