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.

2 answers

  • answered 2018-07-11 05:08 Tamorak

    I want to say it depends on your database model and the data you are fetching from the form. It may be that the data retrieved from the first form is enough to do a desired database modification; in that case, it may be nicer to immediately send the POST data. However, if that data may be needed in a future query, it might be better to send it all at the end to avoid re-sending old data. Some may also argue that doing multiple posts is worse in terms of network usage

    Note: most importantly try to avoid sending duplicate data

  • answered 2018-07-11 05:32 nxSolari

    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.