TOPIC:

How to save each page in a multi-page form? 5 years 8 months ago #158198

  • shin's Avatar
  • shin
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 7
  • Thanks: 0
Hi pedro,

I have checked the AJAX solution and what it does is almost identical to ff_submitForm() without the redirection - that means it still stores the records in the db.
$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.

}

And this php code for the submit piece I think doesn't work as well. I have put it in the begin and end submit and tested $this->sendMail by itself with predefined values but it didn't work. Also, the hidden input 'finished' is working in the initscript when you predefine it, but when you click 'save progress', it doesn't change the value to 0 when it is saved in the records.

In case it is needed, I am using BreezingForms Lite (build 910) and Joomla version, 3.4.5

Please Log in or Create an account to join the conversation.

Last edit: Post by shin.

How to save each page in a multi-page form? 5 years 8 months ago #158293

  • shin's Avatar
  • shin
  • Offline
  • Fresh Breezer
  • Fresh Breezer
  • Posts: 7
  • Thanks: 0
Hi pedro,

I got it to work now! The reason the php submit code was not working was that my begin submit was in custom selected with blank code in it and I forgot it to put to none, so it was definitely my fault. Also, I had moved the ff_getElementByName('finished'); to:
function ff_saveprogress1_action(element, action)
{
    switch (action) {
        case 'click':
        ff_getElementByName('isFinished').value = 0;
        JQuery.ajax({
            type: "POST",
            url: JQuery(element).closest("form").attr("action"),
            data: JQuery(element).closest("form").serialize(),
            success: function(data)
            {
                   alert('Progress Saved!');
            }
          });
            break;
        default:;
    } // switch
}

because it saves the data first before it get overwritten so I have moved it up and now it is working great.

For some unknown reasons, I have checked my email and the formatting is all linear because for some reasons the .nl() is not breaking the line for each data. I have attached the screenshot of what the format looks like.
foreach ($this->maildata as $data)
{
     if ($data[_FF_DATA_TYPE] != 'Hidden Input')
     {
          $body .= $data[_FF_DATA_TITLE].":
          ".$data[_FF_DATA_VALUE].nl();
     }
}
Attachments:

Please Log in or Create an account to join the conversation.

Last edit: Post by shin.
Moderators: ForumSupport
Time to create page: 0.044 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

September Discount!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!