Forums

[Solved] Re: using the multi page plugin

upriidu 03 Aug, 2009
Excuse me for not posting this to the initial thread, but my browser loses the sumbit button in that thread and the page is all scrambled.

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.

Bob



When I try to use this code in the html field, I get an error after saving the step2 form:
Fatal error: Class 'ChronoForm' not found in /www/apache/domains/www.megaherts.ee/htdocs/administrator/components/com_chronocontact/admin.chronocontact.php(2426) : eval()'d code on line 2

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

<div class="form_item">
  <div class="form_element cf_heading">
    <h1 class="cf_text">step2</h1>
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_textbox">
    <label class="cf_label" style="width: 150px;">step2</label>
    <input class="cf_inputbox" maxlength="150" size="30" title="" id="text_4" name="text_4" type="text" />
  
  </div>
  <div class="cfclear"> </div>
</div>

<div class="form_item">
  <div class="form_element cf_button">
    <input value="Submit" name="button_5" type="submit" />
  </div>
  <div class="cfclear"> </div>
</div>
upriidu 03 Aug, 2009
I use a modified version of the same code in another form, in the OnSubmit - after email box to dispaly the the cf_id as an order ID, without receiving the same error. The error is only displayed when using the code in the html code box.

This code works fine in On Submit box.
<?php
$MyForm =& CFChronoForm::getInstance();
$data = $MyForm->tablerow['mhz_chronoforms_test2'];
?>
 <div class="form_element cf_text"> <span class="cf_text">Your order ID: <?php echo $data->cf_id; ?></span> </div>
upriidu 05 Aug, 2009
This thread is solved. I actually managed to complete my goal without using the multiple page plugin. Instead I used profile page plugin to populated necessary fields to the next step. I used a code in OnSumbit - after e-mail box:

<meta HTTP-EQUIV="REFRESH" content="0; url=http://yourdomain.com/index.php?option=com_chronocontact&chronoformname=formname&pluginparameter={uid}">


I also re-popluate the cf_id saved into database by the first form into a hidden field on the second form and this way all steps are saved into one table and under one record.
GreyHead 16 Aug, 2009
Hi upriidu,

Well done, I think that something must have changed in the CF code since I wrote the Multi-page tutorial as I had some similar problems with accessing data yesterday :-(

Bob
tadosborn 06 Nov, 2009
Has this been solved using the multi page plug-in? I'm struggling with the code provided.
This topic is locked and no more replies can be posted.