Validation of Contact Form 7 with custom form action

227 Views Asked by At

I am using Contact Form 7 to collect data (text only) that I need to send to an external url with post. In order to do so, I set up a custom filter with add_filter

    add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
    function wpcf7_custom_form_action_url($url)
    {
        return "myexternalurl";
    }

and disabled AJAX with define('WPCF7_LOAD_JS', false);

However, doing so resulted in loosing the fields validation, since the CF7 validation function in so called anymore. My new action replaces the CF7 action (which was performing the check):

  • Form without changes: validation: OK (with or without AJAX); the form code looks like <form action="/mypage/#wpcf7-f4426-p4427-o1" method="post">
  • Form with custom action: validation not performed; the form code looks like <form action="newurl" method="post">

Is there a way to setup a custom action without loosing the CF7 validation process?

0

There are 0 best solutions below