Hi Tim,
Excellent question! Sure, this can be done - but in all honesty, it's not the most obvious thing in the world.
The Export Manager module handles all the markup generation - i.e the HTML, XML, CSV etc. formats in which form content is downloadable / viewable. So to do what you need, you'll need to create a new "Export Type" for the HTML/Printer-friendly group. Here's how to do it:
1. Go to your Modules page,
2. Select the Export Manager module,
3. Edit the HTML / Printer-friendly Export Group,
4. Click on the Export Types tab,
5. Click the "Add Export Type" button. On the following page, enter the following values into the fields:
Export type name:
Non-empty fields only
Filename:
submissions-{$M}.{$j}.html
Smarty content:
Code:
<h1>{$form_name}</h1>
{* loop through all submissions in the current result set *}
{foreach from=$submissions item=submission name=row}
<table cellpadding="2" cellspacing="0" width="100%" class="print_table">
{* loop through all fields in the current View *}
{foreach from=$display_fields item=field name=col_row}
{assign var=field_id value=$field.field_id}
{assign var=field_type value=$field.field_info.field_type}
{assign var=col_name value=$field.col_name}
{assign var=value value=$submission.$col_name}
{if $value != ""}
<tr>
<th width="140">{$field.field_title}</th>
<td>
{if $field_type == "select" || $field_type == "radio-buttons"}
{smart_display_field_values field_id=$field_id selected=$value}
{elseif $field_type == "checkboxes" || $field_type == "multi-select"}
{smart_display_field_values field_id=$field_id selected=$value multiple=true}
{elseif $field_type == "system"}
{if $col_name == "submission_id"}
{$submission.submission_id}
{elseif $col_name == "submission_date"}
{$submission.submission_date|custom_format_date:$timezone_offset:$date_format}
{elseif $col_name == "last_modified_date"}
{$submission.last_modified_date|custom_format_date:$timezone_offset:$date_format}
{elseif $col_name == "ip_address"}
{$submission.ip_address}
{/if}
{elseif $field_type == "textarea"}
{$value|nl2br}
{else}
{$value}
{/if}
</td>
</tr>
{/if}
{/foreach}
</table>
<br />
{/foreach}
All I did in this code was wrap the output in a test: if the line is empty, don't output anything - not even the label.
Then, go back to your form in Form Tools and view the submissions. At the bottom of the page, in the dropdown for the HTML/Printer-Friendly option, you should see your new "Non-empty fields only" option. Select it and click "display".
Hope this helps!
- Ben