Welcome Guest, Not a member yet? Register   Sign In
Multi-Step Form Data Storing
#3

(08-20-2016, 01:27 AM)ivantcholakov Wrote: I use data within session in such a case.

In an online store ordering is separated in several pages - basket/cart content, client data (names, address, email), payment method, final preview and sending the order, and a flash confirmation page saying that order has been sent. Pages usually have "Back" button (a link to the previous page) and "Continue" button (a submit type button of the current form).

This page sequence is served by a special model "Order_draft" that stores in the session only, it has nothing to do with the database. There is another model "Orders" that manages the orders within the database. When the client clicks on the button "Send Order", the collected data from Order_draft is used by "Orders" for creation of a new order within database. After that, data within Order_draft gets cleared, and based on the newly created order, confirmation/notification email messages are sent.

I would propose to you something similar. Make a tandem of models "Something_draft" (session data) and "Something" (data within database). Let "Something_draft" collect the data from the forms, let "Something" create and manage the submitted data, clear "Something_draft" data on every final submission.

Thank you for the reply. That sounds like an excellent solution.
Reply


Messages In This Thread
Multi-Step Form Data Storing - by jlq10 - 08-19-2016, 02:46 PM
RE: Multi-Step Form Data Storing - by jlq10 - 08-20-2016, 07:11 AM
RE: Multi-Step Form Data Storing - by jlq10 - 08-24-2016, 09:40 AM
RE: Multi-Step Form Data Storing - by Diederik - 08-20-2016, 11:46 AM
RE: Multi-Step Form Data Storing - by Wouter60 - 08-20-2016, 11:49 PM



Theme © iAndrew 2016 - Forum software by © MyBB