Search code examples
reactjsformspoststandardsredux-form

Forms: Should I do a POST on each page of form, or do a single POST at the end of the form flow?


I have a form that is four pages. The user clicks next and this leads them to the next page of the form. On the fourth page the form is complete.

What is the best practice? Do I do a POST after each page, so 4 different times, or should I do one big POST on the last and final page pushing all the user data to the database?

Each page posts to a different endpoint.

My form is created using redux-form and react.


Solution

  • Either works, the main advantages I see are:

    Sending one complete form - advantages:

    • No database pollution
    • Less network overhead

    Sending 4 partial forms - advantages:

    • You can see where each user stopped - this may be useful data if they are purchasing a service or signing up for an account. Do a lot of people fill out the first two sections only to see the third and navigate away?
    • You can use this to save the form server-side for people to complete later. You can also do this with Redux / Local Storage for session / browser storage, but you may want the functionality of a user starting a form on one device and completing it on another, requiring server-side storage of the form.

    If you don't plan to implement the functionality of server-side storage, and if you don't need the extra analytic data of where they stop on the form - just go right ahead and send it all at once. I would suggest at a minimum, you try to save the form to Local Storage to make it easy for the user to pick up where they left off.