I've been working out how the multi-page plugin works and though it would be useful to make some notes of what I have found.
To create a multi-page or multi-step form you need to create one ChronoForms for each step - these are the 'child' forms. Then you need to create one more 'mother' form that will control the process. The Mother form has no Form HTML.
In the ChronoForms Forms Manager check the box by the Mother Form and click the multi-page plugin link in the left hand column. Add the number of child forms and their names in a comma separated list with no spaces. Save the Plugin Configuration.
Go to the link for the Mother Form and you will see the Step 1 child form displayed, when you submit this, the Step 2 child form is displayed and so on.
The Onsubmit Code, Emails and AutoGenerated Code (save to the database) for the Mother form will be run on the final step **only**. If the process is interrupted before this nothing will happen.
If you need intermediate processing then the OnSubmitCode, Emails and AutoGenerated Code for each Child form will be run when it is submitted.
Notes:
1) For the last step the code for the last child form will be run before the code for the Mother form.
2) The OnSubmit Before code for a child form will only be run if emaisl are enabled for that form.
You can access the data from previous steps from the session using
<?php
$session =& JFactory::getSession();
$posted = $session->get('chrono_formpages_data', array(), md5('chrono'));
?>
This will load the data into the $posted array including all previous data and the step number.To save data you will need to create a database table that includes columns for all of the fields on all of the steps. You need to do this by hand, ChronoForms will not automate it. If one child has more fields than the others you can use this as the basis - select the check-box by the form in the Forms Manager, click the Create Table icon and use the Add Another Field button to add the remaining fields.
Enable the DB Connection in the mother form only.
If you want to save data on intermediate steps this is possible. If you enable the DB Conenction on the same table in the Child steps then the data will be saved but each save will be in a separate record. To keep the saves in the same record you need to pass the record id to the next step. Assuming you use the ChronoForms cf-id add this code to the Form HTML in the child form for Step 2
<?php
$MyForm =& CFChronoForm::getInstance();
$data = $MyForm->tablerow['jos_chronoforms_test_form_8'];
?>
<input type='hidden' name='cf_id' value='<?php echo $data->cf_id; ?>' />
This will add the value of the new record into a hidden field.You can repeat this in the remaining steps (or use the value from $posted if you are using that in your form html).
Notes:
1) For the last step you only need the DB Connection for either the last child, or the mother form as they will both save the same data.
2) You don't need the cf_id code for the first child as no data has been saved when that form is displayed.
3) If you have a multi-step form that is to be completed over a longer period, then you could re-load the form data so far from the database table if the session data is no longer available.
Bob