Submit on 1st page then update on second page if further info is provided

How to save form data across multiple pages and update existing records.

Overview

The issue occurs when trying to save initial form data on the first page and then update that same record with optional information from a second page.
Save the first page's data to the database and capture the new record's ID. Pass this ID to the second page using a hidden variable. On the second page, use a second database save action to update the original record with any additional data provided.

Answered
Wh WhiteLighter01 05 Oct, 2016
Hi all,

I'm currently working on a subscribe form that has two pages on it. First page asks for name and email address which are required for the subscription, while the second page ask for added optional information like city, state, country, etc. What I'm trying to do is once the user finished the first page, the info gets recorded to the DB as the user moves to the second page. On the second page, where all the fields are optional, if the user provides additional info, the DB record that was created from the info provided from the first page gets updated with the additional info provided on the second page. How do I go on with this? what would be the best practice to achieve this?

Thanks
Gr GreyHead 07 Oct, 2016
Answer
Hi WhiteLighter01,

Add a DB Save action in the Event that the first page submits to. then capture the ID of the new record and include that in a hidden variable in the next page. I suggest that you call the Primary Key column say cf_id as using id can cause problems.

Use Multi page actions to pass the data between the pages and give any 'repeated' inputs on the second page the same name as on the first. This should pre-load the values from the first page.

Then add a second DB Save linked to the same table in the event the second page submits to and this should them update the records.

I suggest that you test the methodology on a simple form with a couple of inputs to check that it does what you need before building the full version.

Bob
Wh WhiteLighter01 14 Oct, 2016
Thanks for the help. I was not able to test this for our product owner decided to make changes on the requirements.
This topic is locked and no more replies can be posted.