I have a webform that lets users submit feedback about the site but I need to moderate the feedback that comes in.

I've set up a view that has two page outputs, one that shows all submissions that are not yet "Approved" by administrators and gives admins an option to approve them and a second page that shows all submissions to the form that are marked as "approved".

The problem I am having is that the "filter" criteria of views does not show any of the fields that make up the webform so that I can filter based upon them. They show up in the "fields" section of the view but are not an option in the "Filter" criteria.

Is this intentional or is it something that can be added?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

swirt’s picture

Confirmed. Webform data fields are not available for filtering or sorting within Views. It certainly makes things complicated.

As a workaround you could filter in the row section of the page tpl example in a custom tpl like this
views-view-table--webform-subs-guide--page.tpl.php (in this example the view is named 'webform-subs-guide')

Example, filtering for the word 'hello' :

<?php foreach ($rows as $row_count => $row): 
       
 // + Add the line below to filter so that the row does not get output if the view field 'value_1' == to 'hello" ?>
      <?php if ($row['value_1'] == 'hello' ) :?>
      
      <tr <?php if ($row_classes[$row_count]) { print 'class="' . implode(' ', $row_classes[$row_count]) .'"';  } ?>>
        <?php foreach ($row as $field => $content): ?>
          <td <?php if ($field_classes[$field][$row_count]) { print 'class="'. $field_classes[$field][$row_count] . '" '; } ?><?php print drupal_attributes($field_attributes[$field][$row_count]); ?>>
            <?php print $content; ?>
          </td>
        <?php endforeach; ?>
      </tr>

<?php // + add this line to close the IF ?>
      <?php endif;?>
    <?php endforeach; ?>

Unfortunately this only works on a displayed view and not on an exported view into xls

quicksketch’s picture

Category: feature » support
Status: Active » Fixed

Confirmed. Webform data fields are not available for filtering or sorting within Views. It certainly makes things complicated.

You have to add a relationship for Webform Data first, then the filters and sorts become available.

swirt’s picture

Fantastic. Thank you for the leg-up. That worked wonderfully.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

csimmons44’s picture

Version: 7.x-4.0-alpha6 » 7.x-4.2
Issue summary: View changes

Hi, I've added the relationship for Webform submissions: data and selected the component I'd like to use as a filter (file upload field) but the Views filter only appears for the generic 'submission data' and only lets you choose a text filter to match on, not the normal range of Views filters. Is this working as designed? I see quite a few other similar questions around the interwebs, eg http://othermachines.com/blog/filter-form-submission-data-field-value-vi...

If not I'll look custom code or some other method to create a report. Basically I need to filter 10,000 submissions by a single field.

Thanks for any insight you can offer.

DanChadwick’s picture

The only filter available for a file upload filter would be the fid. Yes, it's working as designed. You could filter on the presence of some uploaded file.

Also, I suggest you open new support requests for new issues. You can always reference this older issue.

Renee S’s picture

CSimmins44, check out the "Group filters" option, this allows you to create dropdown with labels and custom query values on the field. See attached screenshot.

Renee S’s picture

(And here's what that created for me.)

andy_w’s picture

We had a requirement to be able to filter submission data in the CMS and added this filter, which allows string searching on any data in any submission, there are obviously a bunch of issues with this, and it would be far too non-performant to be used on the front end with a view.

yaach’s picture

#2 worked for me, thanks.

jaspm2004’s picture

#2 worked for me too, thanks!