-
AuthorPosts
-
April 16, 2024 at 10:27 pm #14539Michal BachratyParticipant
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/
April 17, 2024 at 1:00 am #14544Aakash ChakravarthyKeymasterHi 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?
Thanks,
AakashApril 17, 2024 at 1:57 am #14545Michal BachratyParticipantThanks for the answer, but I don’t really understand it, where should I write the code please?
April 18, 2024 at 1:41 am #14555Aakash ChakravarthyKeymasterHi 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,
AakashJune 4, 2024 at 1:59 pm #14754Michal BachratyParticipantHello, 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
June 4, 2024 at 3:54 pm #14756Aakash ChakravarthyKeymasterHi,
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
June 4, 2024 at 7:41 pm #14759Michal BachratyParticipantno, 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
June 5, 2024 at 2:15 am #14760Aakash ChakravarthyKeymasterHi,
Please use the code below.
<script> document.addEventListener( 'wpcf7submit', function( event ) { UFW.close(1); }, false ); </script>
June 13, 2024 at 1:41 pm #14780Michal BachratyParticipantHello, the second code already works and the widget closes after clicking send, thank you very much for your help.
June 13, 2024 at 1:46 pm #14781Aakash ChakravarthyKeymasterCheers! I’m marking this thread as resolved 🙂
-
AuthorPosts
- The topic ‘Close after click odoslat’ is closed to new replies.