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.

Need drop down form to go to pages within the site.

  1. I need a quote form that will accept a drop down, and a zip code. Based on the dropdown it goes to a certain page within the site for more information. Is there a way to do this in gravity forms???

    Posted 12 years ago on Wednesday February 15, 2012 | Permalink
  2. Hi, jseat,

    Yes, this can be done. There is a Gravity Forms hook called "gform_confirmation" (http://www.gravityhelp.com/documentation/page/Gform_confirmation) that you can use to change the redirect URL. With this hook you can use the page you specified in the drop down as your new redirect URL. Below is an example where I check the values in my drop down and depending on what the user chose, I set what the redirect should be. There is a default condition in case they do not select anything.

    add_filter("gform_confirmation", "custom_confirmation", 10, 4);
    function custom_confirmation($confirmation, $form, $lead, $ajax){
        //only change redirect for form id 64
        if($form["id"] == "64"){
        	//my drop down with values to check is field 1; use field one out of the lead object
        	switch ($lead[1])
        	{
    			case "RG" :
    				$redirect_url = "http://www.rocketgenius.com";
    				break;
    			case "Google" :
    				$redirect_url = "http://www.google.com";
    				break;
    			default :
    				//set default redirect url
    				$redirect_url = "http://www.gravityforms.com";
    				break;
        	}
            $confirmation = array("redirect" => $redirect_url);
        }
        return $confirmation;
    }

    Let me know if you have questions.

    Posted 12 years ago on Monday February 20, 2012 | Permalink
  3. I am sort of a newby to coding in wordpress. I have a good background in code though. Where do I add this code. Does it go in the form_display.php, or does it go in the functions.php?, and where does it need to be placed it that code?

    Thanks,
    Julie

    Posted 12 years ago on Monday February 20, 2012 | Permalink
  4. Hi, Julie,

    You would put the code in your theme's functions.php file. I always add my hooks to the end of the file.

    Posted 12 years ago on Monday February 20, 2012 | Permalink
  5. Do I set the form up as a redirect under settings? That only gives you one option to redirect to, I assume that is the default you want it to go to? Is that correct?

    Posted 12 years ago on Monday February 20, 2012 | Permalink
  6. Never mind, I got it to work. That is so perfect.... THANK YOU!

    Posted 12 years ago on Monday February 20, 2012 | Permalink

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