Forum Replies Created

Viewing 3 replies - 76 through 78 (of 78 total)
  • You could also put some js that will forward to a success page in that same spot in contact-form-7.js if you wanted to do that…

    This is a temporary hack that I did ’cause I have a very long form.

    hide the form on success – it’s confusing if the empty form is still there, especially if it’s taller than one screen.

    open contact-form-7.js
    under line 90 ( if (1 == data.mailSent) )
    add

    var wpcfTheForm = document.getElementById('wpcf7-formid');
    wpcfTheForm.style.display = ('none');

    Then add that id to the form
    Open wp-contact-form-7.php – line 914

    $form .= '<form action="' . $url . '" method="post" id="wpcf7-formid" class="wpcf7-form"' . $enctype . '>';

    A few nice little hacks I just make for this:
    Keep in mind these are dirty-tick hacks that you will have to do over if you upgrade, and might just break everything if you don’t have some idea what you’re doing….

    1) you can put your custom HTML for your success message here:

    wp-contact-form-7.php line 143
    $echo = '{ mailSent: 1, message: "' . js_escape($this->message($cf, 'mail_sent_ok')) . '", ...

    becomes
    $echo = '{ mailSent: 1, message: "<div>your html here - use escape chars!!</div>", ...

    Don’t forget, now your admin panel field does nothing…

    =======================

    2) contact-form-7.js
    hide the form on success – it’s confusing if the empty form is still there, especially if it’s taller than one screen.

    under line 90 ( if (1 == data.mailSent) )
    add

    var wpcfTheForm = document.getElementById('wpcf7-formid');
    wpcfTheForm.style.display = ('none');

    Then add that id to the form – line 914 in wp-contact-form-7.php
    $form .= '<form action="' . $url . '" method="post" id="wpcf7-formid" class="wpcf7-form"' . $enctype . '>';

Viewing 3 replies - 76 through 78 (of 78 total)