Forums

Using Multi page plugin - its OK?

pinochico 01 Oct, 2010
Hello,

I trying practice for use multi page plugin and I have some questions.

Look for my practice:


Multi page forms

01. Create 'mother' form, without form fields=blank html code

02. Create 'child01' form with fields
mail,name,pass,confirm_pass,check1,hidden_12

03. Create 'child02' form with fields
check2

04. Create 'child03' form with fields
radio1011,radio1012,radio1013,radio1014,radio1015,radio1016,radio1017,radio1021,radio1022,radio1023,radio1024,radio1025,radio1026,radio1027,task1

05. Create 'child04' form with fields
radio2011,radio2012,radio2013,radio2014,radio2015,radio2016,radio2017,radio2021,radio2022,radio2023,radio2024,radio2025,radio2026,radio2027,task2

06. Create 'child05' form with fields
radio3011,radio3012,radio3013,radio3014,radio3015,radio3016,radio3017,radio3021,radio3022,radio3023,radio3024,radio3025,radio3026,radio3027,task3

07. Create 'child06' form with fields
radio4011,radio4012,radio4013,radio4014,radio4015,radio4016,radio4017,radio4021,radio4022,radio4023,radio4024,radio4025,radio4026,radio4027,task4

08. Create 'child07' form with fields
hidden_6


09. 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 (1-7) 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.

10. Now I need access the data from previous forms

This code I put in the first line in html code for each child form without first child (2-7)?:

<?php
$session  =& JFactory::getSession();
$posted = $session->get('chrono_formpages_data', array(), md5('chrono'));
?>



11. Create database table that includes columns for all of the fields on all of the steps

I take all fields from 02-08 steps and put by hand in mothers form?

Or put all fields from 02-08 steps and put by hand in all forms (child 01-07 and mothers form)?


12. Enable the DB Connection in the mother form only

13. If I want to save data on intermediate steps keep the saves in the same record:

This code I put in the second line in html code (after first php code with $posted) for each child form without first child (2-7)?:

<?php
$MyForm =& CFChronoForm::getInstance();
$data = $MyForm->tablerow['jos_chronoforms_test_form_8'];
?>
<input type='hidden' name='cf_id' value='<?php echo $data->cf_id; ?>' />


I use $posted in step 10. Is this php code correct?

I enable the DB Conenction on the same table in the Child steps without last child (1-6) and for mothers form

14. How can I re-load the form data so far from the database table if the session data is no longer available?

Some another php code?


Thanks for your reply


Rudolf
GreyHead 01 Oct, 2010
Hi pinochio,

Hopefully I've picked out the important parts here:

10. Now I need access the data from previous forms

This code I put in the first line in html code for each child form without first child (2-7)?:

You only need to do this **if** you need to use the data in this Form HTML, otherwise ChronoForms will carry it on to the remaining steps for you.

11. Create database table that includes columns for all of the fields on all of the steps
I take all fields from 02-08 steps and put by hand in mothers form?
Or put all fields from 02-08 steps and put by hand in all forms (child 01-07 and mothers form)?

You can create the table by hand if you want to. A simple way to have ChronoForms do some of the work for you is to copy the Form HTML from each of the steps **temporarily** into the Mother Form (or a new form) and use that with the ChronoForms Create Table icon. Once you have created the table delete the Form HTML from the mother form (or delete the whole temporary form).

13. If I want to save data on intermediate steps keep the saves in the same record:
This code I put in the second line in html code (after first php code with $posted) for each child form without first child (2-7)?:

<?php
$MyForm =& CFChronoForm::getInstance();
$data = $MyForm->tablerow['jos_chronoforms_test_form_8'];
?>
<input type='hidden' name='cf_id' value='<?php echo $data->cf_id; ?>' />

Yes, but You don't need the $posted code; and you do need to replace jos_chronoforms_test_form_8 with the name of your table.

14. How can I re-load the form data so far from the database table if the session data is no longer available?

Yes, you'll need to use PHP like that explained in the recipe "Getting information from a DB table to include in your form" on page 330 of The ChronoForms Book (I see you have the book already).

Bob

PS I cannot stress enough that when you start out with Multi-page forms create a small test form with two or three simple child forms with only one or two inputs each to see how they work together. When you have the basic parts working, then you can add more inputs and more steps.
This topic is locked and no more replies can be posted.