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.

Pass Page 1 Data to Page 2

  1. Is there anyway to reference "Field Data" from page 1 on Page 2 of a multi page form? Example: If I require Name on page 1 can I display "name" on page 2?

    Posted 12 years ago on Wednesday January 4, 2012 | Permalink
  2. Sorry for the delayed response. Yes, it is possible to reference data from page 1 on page 2. You may use the hook "gform_pre_render" and pull the information you need out of $_POST. The documentation is located at http://www.gravityhelp.com/documentation/page/Gform_pre_render .

    Below is a sample I made. I have two pages. The first page has first name and last name. The second page has an html field that I populated with the first/last name from the first page.

    add_filter("gform_pre_render", "populate_welcome");
    function populate_welcome($form)
    {
    	//only get data form form id 31
    	if ($form["id"] == 31)
    	{
    		//check what page you are on
    		$current_page = GFFormDisplay::get_current_page($form["id"]);
    		if ($current_page == 2)
    		{
    			//set the field on page 2 to the first/last name from page 1
    			//get the name
    			$first = rgpost("input_1_3"); //first name field when using the normal name format broken into two fields
    			$last = rgpost("input_1_6"); //last name field when using the normal name format broken into two fields
    			foreach($form["fields"] as &$field)
    			{
    				//html field (id 3) on second page which will display name from first page
    				if ($field["id"] == 3)
    				{
    					$field["content"] = "Welcome, " . $first . " " . $last;
    				}
    			}
    		}
    	}
    	//return altered form so changes are displayed
    	return $form;
    }
    Posted 12 years ago on Friday January 20, 2012 | Permalink

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