Hi @fcis999,
Trust you are doing good and thank you for reaching out to us.
The following code snippet should help to display a message before redirecting to a new URL on form submission.
<?php
add_action( 'wp_footer', function(){
global $post;
if( ! $post instanceof WP_Post || ! has_shortcode( $post->post_content, 'forminator_form' ) ) {
return;
}
?>
<script type="text/javascript">
jQuery( document ).ready( function($) {
setTimeout(function() {
$('.forminator-custom-form').trigger('after.load.forminator');
},100);
$(document).on('after.load.forminator', function(event, form_id) {
jQuery('form.forminator-custom-form').on('forminator:form:submit:success', function (e, formData) {
var form_id = e.target.id;
if ( form_id == 'forminator-module-2910' ) {
setTimeout(function(){
window.location.replace("https://mylocal.local");
}, 2000);
}
});
});
});
</script>
<?php
}, 9999 );
Please be aware that the submission behaviour should be set to “Hide Form” under the Behaviour tab of the form. You can specify the message to display in that section. The provided code snippet will manage the redirection.
You need to change the form ID from 2910 to your form’s ID and the redirect URL should be changed from https://mylocal.local to the desired redirect URL. The code could be added using mu-plugin, I hope the following guide helps: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins
Please feel free to get back to us if you need any clarification, we are happy to help.
Kind Regards,
Nebu John