• I’m using contact form to do an anonymous customer survey and I would like to somehow get the customers to a page with a discount coupon on it (that’s their promised reward for completing the survey). (I can’t email them the link because then they wouldn’t be anonymous.)

    I tried putting the text link in the messages field, but it just feeds it back as text rather than a link.

    I looked at the files and it appears that a script is sanitizing my message fields.

    Any help would be appreciated. I use Contact Form 7 in all my and my customers WP sites. …and yes, I have donated ;>) because it’s GREAT software.

Viewing 12 replies - 1 through 12 (of 12 total)
  • valerama, probably you can get it with this:

    Open contact-form-7.js, you’ll find wpcf7ProcessJson() function defined. Insert these lines into the bottom of it.

    `if (1 == data.mailSent) {
    wpcf7ResponseOutput.append(‘<div>link</div>’);
    }`

    Edit the link as you like.

    No, this is correct:

    `if (1 == data.mailSent) {
    wpcf7ResponseOutput.append(‘<div>link</div>’);
    }`

    Grrrr…
    I mean

    if (1 == data.mailSent) {
    wpcf7ResponseOutput.append(‘<div>< a href=”https://www.google.com&#8221; >link< /a ></div>’);
    }

    if (1 == data.mailSent) {
    wpcf7ResponseOutput.append(‘<div>< a href=”https://www.google.com&#8221; >link< /a ></div>’);
    }

    Sorry for my repeating posts. I hope it helps you.

    Thread Starter valerama

    (@valerama)

    It appended it with all the html code, which is the same result I got when I put the code in the message field. I wonder if I can just change the code in the DB?

    Has anyone got this work? I would like to send my submitters to a thank you page too, but I could not get this to work

    I would like to send the person submitting a comment to a new page, ( like a thank you page.) The solution here is not working. Can this be an option in future updates under message options? have an area where you can type the permalink to the thank you page?

    Is this possible? How would I fix this issue?

    Thanks

    Dan

    Anyone able to get this to work? I can not get takayukisters fix to work. I would like to be able to forward the response to a thank you pages. Or at least move the thank you message above the form.

    Thanks

    Dan

    Anyone out there know how I can get this to work?

    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 . '>';

    Is there a working solution to this now?

    takayukister’s solution doesn’t work for me (just shows html as text)

    squarecandy’s solution appears to reference an earlier version of Contact Form 7, since there aren’t 143 lines in wp-contact-form-7.php

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Contact Form 7 – forward success page or link in success message’ is closed to new replies.