Maybe I should try another approach to get a review page AND a showing it as a last step at the top of the form.
I disabled the review page and created an extra normal page (page 4) with a html-field (id=87). Now I want to pass the entries/values from previous pages 1, 2 and 3 to the html-field on page 4.
Tried with simple text first, which outputs ‘This is an example’ in my html field, just as I expected:
add_filter( 'gform_pre_render_1', 'populate_html' );
function populate_html( $form ) {
$current_page = GFFormDisplay::get_current_page( $form['id'] );
$html_content = 'This is an example';
if ( $current_page == 4 ) {
foreach( $form['fields'] as &$field ) {
//get html field
if ( $field->id == 87 ) {
//set the field content to the html
$field->content = $html_content;
}
}
}
return $form;
}
Then I replaced the simple text by GFCommon::replace_variables, however this gives no output in the html.
add_filter( 'gform_pre_render_1', 'populate_html' );
function populate_html( $form ) {
$current_page = GFFormDisplay::get_current_page( $form['id'] );
$html_content = GFCommon::replace_variables( '{all_fields}', $form, $entry );
if ( $current_page == 4 ) {
foreach( $form['fields'] as &$field ) {
//get html field
if ( $field->id == 87 ) {
//set the field content to the html
$field->content = $html_content;
}
}
}
return $form;
}
Anyone knows how to get the data to show up on my last page.
That can’t be done with the review page, as this review page is only displayed after submission. Maybe the following third-party add-on from one of our certified developers which provides a different approach could help: Gravity Forms Preview Submission | Gravity Perks by Gravity Wiz
Thanks Samuel, I solved the issue with the free version of the preview submission: Better Pre-submission Confirmation - Gravity Wiz. After adding this code to my functions.php, I only needed to add the merge tags in the html field and the values will appear as expected.