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.

Conditional logic on submit to page or redirect

  1. I'm building a customer review app. If the ratings are poor or fair, I have conditional logic set up to ask for name and phone number and want that information passed through via email and redirect to a page with the information for contacting us and to let the customer know we want to make things right.

    When the ratings are good to excellent, I'd like the rating passed through via email and a redirect to either Yelp, Google, Bing or Yahoo according to the form being used. I will have a form for each review site or if it's easier a radio button listing the options to enter a review with those choices.

    I hope I explained this well enough. Thank you for your help.

    Posted 6 years ago on Friday April 19, 2013 | Permalink
  2. I have looked at numerous examples in the documentation and forum but can't seem to put together the right code. The form can either have conditional logic to enable the poor/fair ratings name and phone # to be completed on the first form or sent to another page with that form (either way is fine, I have the first example set up now). I have the values for ratings poor/fair set to 1.

    The conditional logic for the second part for ratings good/excellent (values set to 2) need to be redirected to one of the review sites. I can have separate forms for this or use one form with a radio button so the redirect will know which url to use. I do not have this set up yet, not sure what to do.

    Thanks again.

    Posted 6 years ago on Friday April 19, 2013 | Permalink
  3. Can someone please help?

    Posted 6 years ago on Saturday April 20, 2013 | Permalink
  4. I have followed the instructions from this post. http://www.gravityhelp.com/forums/topic/terms-of-conditions?replies=13#post-7442

    Link to form: http://spmmemphis.com/customer-review-app/yelp-review/

    Note: I have four selections (poor, fair, good, excellent) but for the sake of getting this to work I have only used two selections (poor, good) but will want to use all four selections when completed (figured I may need an array but don't know how to do that). I will also have four forms like this, one for each review site (Yelp, Google, Yahoo, Bing), unless you can suggest an easier way.

    From GF post...

    You'll want to create a totally new file for the page template.. I called mine template_redirect.php in the root of the theme directory. Open that file, and add this..

    ---Done

    This is the code used in my file named, template_redirect.php loaded to my themes directory.

    <?php
    // redirect form based on the rating value passed in querystring
    $rating = $_GET['rating'];

    switch ($rating)
    {

    case "poor":
    // if poor redirect to the following page
    header("Location: http://spmmemphis.com/customer-review-app/we-want-to-make-it-right/");
    break;

    case "good":
    // if good redirect to the following page
    header("Location: http://www.spmmemphis.yelp.com/");
    break;

    }

    /*
    Template Name: form terms redirect
    */

    ?>

    Since we're using this simply for a redirect, we don't need anything else on the page. Of course, you'll configure the URL's to your actual destination pages.

    ---Done

    Next, you'll want to go to "add pages", create a new page then select the "form terms redirect" as the page template. Name the page "redirect" then save everything.

    ---Done

    page settings

    Next, go to your form, click on the form settings at the top of the page, then the confirmation tab. Select the "redirect" option under the confirmation message heading. There you will put in the URL of the page you want to redirect the form to.. in this case, to the page you just created so something like.. "http://www.yourdomain.com/redirect/"

    ---Done

    Then, you'll need to check the "Pass Field Data Via Query String" option and build your query string. You have to manually add the first portion "agree=" then select from the drop down list directly above that field and find the "agree" field in your form, click on that and it will insert the proper token to populate the query string.

    ---Done

    Link to sample of the form settings -- http://spmmemphis.com/customer-review-app/sample-gravity-forms-settings/

    Save the form settings, then go test your form. The form should redirect to the confirmation page you created, then based on the agree field value passed to it, will redirect to whatever page you want from there.

    ---Done

    Now i get this error message: Warning: Header may not contain more than a single header, new line detected. in /home/spmmemph/public_html/wp-content/plugins/gravityforms/form_display.php on line 88

    Researching that now.

    Posted 6 years ago on Saturday April 20, 2013 | Permalink
  5. Hello - It would be nice to get some help here, please.

    I migrated the site to a subdomain to work on it without interference on the main site. I also deactivated all plugins except for Gravity Forms and tested in Twenty Ten, Twenty Eleven and Twenty Twelve themes and still got this error message.

    Warning: Header may not contain more than a single header, new line detected. in /home/spmmemph/public_html/customer-review-app/wp-content/plugins/gravityforms/form_display.php on line 88

    Apparently it's Gravity Forms, not a plugin or my theme.

    LInk to test site: http://customer-review-app.spmmemphis.com/yelp-review/

    Thanks

    Posted 6 years ago on Tuesday April 23, 2013 | Permalink
  6. No need to look at the form now, it's completely torn down, I've tried so many things trying to make it work. :-(

    Posted 6 years ago on Tuesday April 23, 2013 | Permalink
  7. Handling via priority support.

    Posted 6 years ago on Friday April 26, 2013 | Permalink

This topic has been resolved and has been closed to new replies.