A
A
Andrey2021-08-09 17:26:11
WordPress
Andrey, 2021-08-09 17:26:11

How to close a form in cf7 after successful submission?

How to close a form in cf7 after successful submission?
I use remodal for a modal window in which there is a form
in remodal, the window closes, for example. button with date attribute data-remodal-action="close"

<button class="close" title="Закрыть окно" data-remodal-action="close"></button>

I insert this attribute in add. form settings - nothing happens
how to make the form close after submission?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeniy, 2021-08-09
@klekovkinandrey

Something like this, you can finish it a bit .. the form will close 3 seconds after sending

document.addEventListener( 'wpcf7mailsent', function( event ) { 
  if ('ТУТ ID ФОРМЫ ЦИФРЫ' == event.detail.contactFormId) { 
    setTimeout(function(){ // закрытие модальки
      $( ".close" ).trigger( "click" ); // клик по кнопке
    }, 3000);
  }	
}, false );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question