webform submission page : hide empty fields

Created on 2 May 2017, over 7 years ago
Updated 26 January 2023, almost 2 years ago

Hi,

I redirect the user after submitting the form, to the "submission page" with node/[node:nid]/submission/[submission:sid]

The user sees an overview of the results of his form on one page.

I looked into "webform-submission-page.tpl.php", and saw that the output was rendered by this "drupal render" function:
print render($submission_content);.

How can the "empty form fields" be hidden on the "submission page", and also their label ?

Maybe some hook like this ?

<?php
function mytheme_webform_element_text($element, $value) {
  // Check if there is any value to print out at all, if not, return an empty string.
  if (strlen(trim($value)) == 0) {
    return '';
  }
  // Call the default theme function if there is a value.
  return theme_webform_element_text($element, $value);
}
?>

I'm curious for input ... thank you

💬 Support request
Status

Fixed

Version

4.0

Component

Code

Created by

🇧🇪Belgium ananda

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇵🇹Portugal miguelbraga

    Dear Liam,

    Going back to this topic, I'm not sure how to edit the webform-submission.tpl.
    I've done a new webform-submission-573.tpl for the target form but if I change print drupal_render_children($renderable); to any other tag like print render($form['submitted']['first_name']); it doesn't works. What the logic behind this file? print drupal_render_children($renderable)['submitted']['first_name']); ?

Production build 0.71.5 2024