xxxxxxxxxx
<script type="text/javascript">
document.addEventListener( 'wpcf7beforesubmit', function( event ) { // replace wpcf7mailsent with wpcf7beforesubmit to make form work without fill the form
//alert(event.detail.contactFormId); // check real Form Id
if ( 'realFormId' == event.detail.contactFormId ) {
//alert(event.detail.contactFormId); // check Form Id is correct
//your code here...
}
}, false );
</script>