Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • Michal Bachraty
    Participant

    Hi i use this widget on my client website and i need to do when someone click button cenova ponuka and fill all fields and send contact formular which is created on contact form7 i need to automatic close whole widget after clicking on ODOSLAT is it possible ?

    this is the website: https://mtmmal.sk/

    Hi Michal,

    Yes, it is possible. You can use the JavaScript call below to close the flyout once the form is submitted. Can you please refer the doc below?

    Custom trigger

    Thanks,
    Aakash

    Michal Bachraty
    Participant

    Thanks for the answer, but I don’t really understand it, where should I write the code please?

    Hi Michal,

    The plugin does not know the contents of the widget box are. I see you have a form here. You can check with the form plugin author and see if there is an option to call the function above as in the docs.

    I would suggest the JS code below from my side.

    <script>
    document.addEventListener('DOMContentLoaded', function() {
      const wpcf7Form = document.querySelector('.wpcf7-form');
    
      if (wpcf7Form) {
        wpcf7Form.addEventListener('submit', function(event) {
          UFW.close(1);
        });
      }
    });
    </script>
    

    Please paste this JS code snippet in your website.

    Thanks,
    Aakash

    Michal Bachraty
    Participant

    Hello, I put the code in the header and in the body, but even the option did not work and the widget still does not close after clicking submit

    Hi,

    Was the code working previously?

    I looked at your website source code but couldn’t find the above code snippet.

    Can you please confirm if the code is inserted?

    Thanks

    Michal Bachraty
    Participant

    no, it didn’t work at all, I put it there today because I forgot about this topic… and I put it both in the header and in the body of the page and it didn’t work, so I deleted it, but I’ll put it there again. I am attaching a picture

    Paste the code in body

    Hi,

    Please use the code below.

    <script>
    document.addEventListener( 'wpcf7submit', function( event ) {
          UFW.close(1);
    }, false );
    </script>
    Michal Bachraty
    Participant

    Hello, the second code already works and the widget closes after clicking send, thank you very much for your help.

    Cheers! I’m marking this thread as resolved 🙂

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Close after click odoslat’ is closed to new replies.

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam. View newsletter