SAVE INFORMATION IN DB ON EACH MULTIPAGE STEP

Sometimes when filling out a large form it would come in handy if you can come back at a later point and continue where you last stopped. Unfortunately this is not a built in feature but it can be done with some custom coding and proper setup.


For this to work you will need to have a multipage form.

  1. Disable “Email notification” inside Form Properties as we will use Custom PHP email for this. You can read more on custom PHP emails here : https://crosstec.org/en/support/online-documentation/breezingforms/12-examples-scripts/746-new-custom-php-email-that-includes-attachment.html

  2. On your last form page create a hidden element, and give it name “finished”.

  3. Navigate to your form's Advanced Options > Actionscript > Custom > Actions “Click” >  Create code framework and add this code in between {} . This will populate the hidden field with value of 1.
    ff_getElementByName('finished').value=1;
  4. On each form page you will need to create a CUSTOM BUTTON.
    This button will SAVE all the info to the DB, but WILL NOT trigger an email notification at least not until you come to the last page form where we will make a condition :
if($finished==1){
$this->sendMail();
}

       Go to this buttons Advanced Options > Actionscript > Custom > Actions “Click” > Create code framework and add this code in between {}

switch (action) {
        case 'click':
JQuery.ajax({
          type: "POST",
          url: JQuery(element).closest("form").attr("action"),
          data: JQuery(element).closest("form").serialize(),
          success: function(data) {
            ff_validate_nextpage();
            ff_getElementByName('finished').value=0;
        });
           break;
        default:;
    } // switch

     This will need to be done FOR ALL pages EXCEPT the LAST Page ( NOT THANK YOU PAGE ) where you need to add the following code :

        switch (action) {
        case 'click':
JQuery.ajax({
          type: "POST",
          url: JQuery(element).closest("form").attr("action"),
          data: JQuery(element).closest("form").serialize(),
          success: function(data) {
             ff_validate_nextpage();
            ff_getElementByName('finished').value=1;
        });
           break;
        default:;
    } // switch

 
Now on final page right before the submit following code will set value to “1” which will make to form able to submit the info.

5) Finally you need to create a custom PHP email. Go to  Form properties->advanced->more options->submit pieces->custom and put the following code into the box:

$this->execPieceByName('ff_InitLib');
$finished = ff_getSubmit('finished');
$fromname = 'Your from Name'; //  /* Change to desired from name */
$recipient = 'your@email.com'; /* Change to Your Admin Email Address */

// Create the Body format for use in e-mail

foreach ($this->maildata as $data)
{
     if ($data[_FF_DATA_TYPE] != 'Hidden Input')
          $body .= $data[_FF_DATA_TITLE].":
          ".$data[_FF_DATA_VALUE].nl();
}

if($finished==1){ 
$this->sendMail($from, $fromname, $recipient, $body); // This line actually emails the form.
}

Note that in the code above we are transferring the variable 'finished' so we can test to see if it’s value iz 0 or 1. Based on that we do the following : 

if($finished==1){ 
$this->sendMail($from, $fromname, $recipient, $body); // This line actually emails the form.

 This will send the info saved previously as one email notification.

If you have additional questions about this please visit our Forums.



All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here