I have a form in view A that the user needs to fill. Also on the page (before the “submit” button”) is an optional link that takes the user to a different view B so he can input more optional information. In form B, when clicking the “Submit” button, form B is saved, and the user is returned to view A.
At this point though, all the information initially inputted in form A (before clicking the optional link) is lost after the user clicks the optional link that takes him to form B. How can I retain this information, so that when the user is brought back to the page, he doesn’t have to re-input everything.
1.
You can use a session data or a cache. Instead of redirecting to the B view, send an A form into a special view, which will generate a random key and store received POST data in a sesion data / cache. Than redirect to the B view, passing the key. When submitting B the key is passed again, and used after redirection to view A to retrieve the saved POST data.
2.
You can add an invisible form from A view into a B view to preserve data.
3.
You can use a Web Storage and save the form data on a client side under randomly generated key.
—
Note that all of these solutions are very similar and differ mainly in the storage place.