Slider Modal with Contact Form 7 Fix

This article will show you how to fix the Contact Form 7 when it is used in a Slider Modal.

This error will show if a Contact Form 7 is used in a Slider Modal:

To fix this, insert the custom JS code below into the slider modal

document.addEventListener("sr.slide.afterChange", function (e) { 
  if (!wpcf7?.init) return; 
  document.querySelectorAll('form.wpcf7-form').forEach(form => { 
     if (!form.initialized) { wpcf7.init(form); 
      form.initialized = true; } 
  }); 
});

To locate your current slider API number, open the API tab and click on a method.

Slider Modal with Contact Form 7 Fix

The Author

KC

Strength does not come from winning. Your struggles develop your strengths. When you go through hardships and decide not to surrender, that is strength.

If you need help with anything related to our plugin, please comment on a post or email me at [email protected].

Liked this Post?
Please Share it!

11 thoughts on “Slider Modal with Contact Form 7 Fix

  1. I had solved the problem of the number “0” some time ago thanks to this code. Everything worked perfectly until yesterday. Unfortunately, without touching anything to the code, the error started recurring again, I don’t know if due to the latest Slider Revolution update. The JS code was entered correctly but the error still occurs.

    1. Hello,

      thanks for contacting us! Your request requires one of our support agents to have a closer look.

      In order to give our clients the best support possible, we are having a support ticket system reachable via the link below.

      Please use it for your upcoming questions concerning one of our products. This will guarantee the fastest answer possible. Support requests here cannot be answered unfortunately. Thank you!

      Please use our ticket systems over at:

      https://support.sliderrevolution.com

      Cheers Dirk @ Slider Revolution

      1. I solved the problem and I write the solution here, hoping it will be useful to those who have encountered the same error. Version 5.4 of Contact Form 7 evidently has some bugs. I solved it by simply downgrading to the previous version.

  2. Hello Support,

    code works, thank you.

    However, the messages for the form are not displayed, for example, if an error was made when filling out the form or the email was sent via the form. What is the reason for this?

    Thanks a lot!

    Dennis

  3. Hi,

    I’m experiencing something similar using WPForms. It works if I add WPForms shortcode directly to a Slider but the moment I add it to a Slider Modal, I get a 0.

    Any suggestions on how to resolve this will be gratefully appreciated.

    Many thanks 🙏🏾

    1. Hello,

      thanks for contacting us! Your request requires one of our support agents to have a closer look.

      In order to give our clients the best support possible, we are having a support ticket system reachable via the link below.

      Please use it for your upcoming questions concerning one of our products. This will guarantee the fastest answer possible. Support requests here cannot be answered unfortunately. Thank you!

      Please use our ticket systems over at:

      https://support.sliderrevolution.com or https://support.essential-grid.com

      Cheers Dirk @ Slider Revolution

    1. Hi Jee Ka,

      Thanks for your message. Both desktop and mobile should work the same. Please try clearing your browser cache and see if it helps. If the issue persists, please open a support ticket in our support systems over at: https://support.sliderrevolution.com and we’ll investigate this further for you.

      Cheers KC @ Slider Revolution

Leave a Reply

Your email address will not be published. Required fields are marked *