Change action in Contact Form 7

Would modify the action of Contact Form 7 once sent the mail.

I follow this post and woks fine. But my fom is in a Bootstrap Modal, and I wish they would keep open on submit.

Read More

My code is.
In function PHP

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url'); function wpcf7_custom_form_action_url() {  return 'http://saviacomunicacion.com.ar/test2014#sala-de-prensa'; }

And in the Aditional Settings field

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');

This redirect the URL, but it´s not sending the mail.
I wish i could send the mail and keep the modal open to show the response: Your mail was send correctly.

Thanks

Related posts

2 comments

  1. According to the doc there is another way to accomplish the redirect. Just add some piece of code to the plugin dashboard.
    Or you can do custom js function

    in the plugin options

    on_sent_ok: "customFunction();"
    

    and somewhere in the code

    <script>
        function customFunction() {
            // show your modal here
            $('#myModal').modal();
        }
    </script>
    
  2. I found my solution with this code. When form submit, the Modal closes after 1 second.
    Instead of keeping Modal open, i wait 1 second after close, to show the response of the sending.

    j(".form-horizontal").live("submit", function(){
            j.post(this.action, j(this).serialize(), function(){
                //this callback is executed upon success full form submission close modal here
    
            }, "script");
         //this is to wait 1 second until close
            setTimeout(function() {j('.modal').modal('hide');}, 1000);          
            return false;
        });
    

Comments are closed.