PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Redirect to a page and display form's confirmation message on that page

  1. Hello,

    Apologies if this was asked before, I couldn't find an exact question.

    I would like to redirect a visitor on submitting a form to a WP page and also display that form's confirmation message (before other page info). This WP page is also accessible by itself. However, I only want to display the form's confirmation message on that page if it was redirected to after submitting a form. Ideally, I don't want to use URL parameters.

    Can I add some code to a page template or do it via hooks somehow?

    Many thanks, Dasha

    Posted 7 years ago on Monday March 18, 2013 | Permalink
  2. David Peralty
    Administrator

    The page you would be sending the user to would be outside of Gravity Forms' control, and as such, you would have to use query strings to pass data to that page.

    Posted 7 years ago on Monday March 18, 2013 | Permalink
  3. Hello David,

    Thank you for letting me know.
    I was trying to use a global, so it will be set after the form goes through gform_confirmation filter. Something like that:

    global $gf_data;
    $gf_data = "";
    add_filter("gform_confirmation_2", "add_story_custom_confirmation", 10, 4);
    function add_story_custom_confirmation( $confirmation, $form, $lead, $ajax ){
    	global $gf_data;
    
    	$gf_data .= "Thank you for submitting a story. We will be in touch soon.";
        return $confirmation;
    }

    Than in the template that a visitor redirected to I'm displaying the global $gf_data as:

    global $gf_data;
    echo "<h1>GF DATA</h1>";
    echo $gf_data;

    I've tested and the global $gf_data is setup in the filter before return $confirmation. However, it doesn't seem to appear on the page template.

    I was wondering if such work around will be possible, perhaps, I'm missing something out? Or this is not possible at all?

    I would appreciate your help.
    Many thanks, Dasha

    Posted 7 years ago on Monday March 18, 2013 | Permalink
  4. David Peralty
    Administrator

    I don't think it will work this way. You could use the pre-submission hook to push all the submitted details to session variables or a cookie and use PHP to pull those details on the page you've redirected them to.

    Posted 7 years ago on Monday March 18, 2013 | Permalink
  5. Hello David,

    Thanks for letting me know. Hmm, I'm really confused now, I'm using gform_pre_submission hook, but the global doesn't have any values after the redirect. I'd thought because it's a global variable, it will have the value saved after the redirect.

    I will try session..

    Many thanks, Dasha

    Posted 7 years ago on Tuesday March 19, 2013 | Permalink
  6. Hello David,

    Session works well with the gform_pre_submission hook.

    I'm still a bit unclear why the global didn't work.. if you could explain it that would be great, would be nice to learn. No worries if you're too busy.

    Many thanks, Dasha

    Posted 7 years ago on Tuesday March 19, 2013 | Permalink