Hi, SlickSites,
Yes, this is possible. You can display data from one page on another by using the "gform_pre_render" hook (http://www.gravityhelp.com/documentation/page/Gform_pre_render). Below is an example I provided to another user where they displayed the name on the second page of their multi-page form:
add_filter("gform_pre_render", "populate_welcome");
function populate_welcome($form)
{
//only get data form form id 31 (or use gform_pre_render_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 (was field 1 on this form)
$last = rgpost("input_1_6"); //last name field when using the normal name format broken into two fields (was field 1 on this form)
foreach($form["fields"] as &$field)
{
//html field (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;
}
If you simply want to display this info in your confirmation text, in your Form Settings, you can use "Insert Merge Tag" and select your field. You can use HTML in there as well.
Take a look and let me know if you have questions.
Posted 12 years ago on Wednesday March 14, 2012 |
Permalink