I think this feature is very nice to administrator to manage to webform result.

Thanks for this great module. =)

Comments

scott m. sanders’s picture

+1 for this.

knalstaaf’s picture

Version: 7.x-3.17 » 7.x-3.x-dev
quicksketch’s picture

Title: Add checkbox on the webform result page so user can select multiple result and delete them » Add checkbox on the webform result page so user can select multiple result and delete them (Views Bulk Operation style)
Version: 7.x-3.x-dev » 7.x-4.x-dev

Thanks this is a good suggestion. Note that if you so desired, you could add this functionality immediately by configuring a View and using Views Bulk Operations to replace the default listing of submissions with a view... though I suppose we'd need to make Webform provide some actions to allow bulk deletion through VBO.

It's a good request, but I'm not sure how I'd like to handle it. It seems like rebuilding the VBO interface (the same way Node and Comment module do) is a wasted effort, especially when we already have Views support.

However like all features, this would only be added to the 4.x release. 3.x is maintenance only at this point.

sonicthoughts’s picture

+1 Definitely high value!

aniket_m’s picture

Can anyone knows how to bulk delete webform submissions?
I tried "Bulk Operation" for multiple delete, but not succeed in that.

Thanks in advance

johnofjack’s picture

Issue summary: View changes

quicksketch, as you mention, bulk deletion isn't currently possible in VBO. If you wanted to bulk delete webform submissions, would you recommend writing a custom VBO action, or is there a better way for it?

Thanks!

Kuldip Gohil’s picture

+1 Must needed

danchadwick’s picture

A patch to add the actions to allow VBO to work with webform are welcome.

danchadwick’s picture

Once the hard-coded tables are replaced with views and actions are added, the user could do this by modifying the built-in view for displaying the results.

Marking as postponed pending progress on using views internally.

danchadwick’s picture

This is now possible once #2330557: Replace hard-coded tables with views is committed, however someone needs to write the delete VBO action. @johnofjack -- want to take that on?

danchadwick’s picture

Status: Active » Closed (won't fix)

Closing for lack of activity and the ability to write the VBO action needed. Please re-open if you have a patch.

drupaledmonk’s picture

People coming here for a solution: Have a look at this contrib module which has similar functionality. https://www.drupal.org/project/webform_submissions_multiple_delete

johnodonnell@mac.com’s picture

I stumbled across this thread while trying to find a way to delete a large number of submissions (over 3000). Using Clear didn't work, the function would choke under the number of records. Webform tries to load all submissions at once before deleting. But I found a hack around this.

I looked in the web form.report.inc file and found this line inside the webform_results_clear() function

$submissions = webform_get_submissions($nid);

webform_get_submissions() takes a pager value that indicates the number of records to return with a default value of all. Setting it to a more manageable number enables you to clear submissions a few hundred at a time.

$submissions = webform_get_submissions($nid, NULL, 200);

Once you clear all your submissions, you can change it back.

duncan.moo’s picture

The following sandbox module provides VBO for webform results: https://www.drupal.org/sandbox/catchsaid/2237707

The issue with the module https://www.drupal.org/project/webform_submissions_multiple_delete is that it is not a view and therefore would not support a likely usecase where one would want to filter results and then bulk-delete the filtered subset.

danchadwick’s picture

Hmmm. Not opposed to rolling that vbo support into webform core. It's a pitty that hook_action_info doesn't allow a file option so that the VDO code wouldn't have to be loaded for every page.

If someone is interested, please re-open with a patch and round up someone else to review it.

RAWDESK’s picture

Status: Closed (won't fix) » Active
RAWDESK’s picture

I've been experimenting briefly with this sandbox solution at #14 and came up with a first conclusion :

The new VBO action, as returned by webform_vbo_action_info(), is not visible in the views bulk operation field setting :
/admin/structure/views/nojs/config-item///field/views_bulk_operations
So no entrypoint to be able to test committed code.

Since VBO actions are entity type compliant, i've changed the action type from 'node' to 'entity' at
sites\all\modules\webform_vbo\webform_vbo.module

/**
 * Implements hook_action_info
 */
function webform_vbo_action_info() {
  return array(
    'webform_vbo_delete' => array(
      'type' => 'entity',
      'label' => t('Delete Webform submission'),
      'description' => t('Delete Webform submission'),
      'configurable' => FALSE,
      'hooks' => array(
        'any' => TRUE,
      ),
      // Set to TRUE if you want to operate on an array of identifiers
      // Set to FALSE if you want to operate on each separately as an object
      'aggregate' => FALSE,
      // Set this to true to receive $context['rows']  in your callback.
      'pass rows' => TRUE,
    ),
  );
}

Did the same change at sites\all\modules\webform_vbo\views\webform_vbo_bulk_operations_handler_field_operations.inc

/**
* @file
* Views field handler. Contains all relevant VBO options and related logic.
* Implements the Views Form API.
*/

class webform_vbo_bulk_operations_handler_field_operations extends views_bulk_operations_handler_field_operations {
  /**
   * Need to override this so that vbo uses the webform the submissions belong to.
   */
  public function get_entity_type() {
    return 'entity';
  }
}

I was then able to trigger the new VBO action "Delete Webform Submission" from my view, but the same error was given as reported at https://www.drupal.org/node/2674906.

This error originates from this public function in VBO class views_bulk_operations_handler_field_operations

So i am concluding that the class extension on this function, as written inside this sandbox module, is not working as supposed to.
Instead of the inherited get_entity_type() function, it is calling the original instead, and returning the error via _views_bulk_operations_report_error().

Not familiar with class extention within Drupal between 2 separate module.
What I've tried is adding this line on top of the main webform_vbo.module :
module_load_include('inc', 'views_bulk_operations', '/views/views_bulk_operations_handler_field_operations.inc');
but without luck yet.

If anybody wants to dig further into this, i'm volunteering some extra time to cooperate and find a solution with this sandbox module.

RAWDESK’s picture

#UPDATE
Discovered the reason why the get_entity_type() was not triggered from the inherited class in this sandbox module.

Inside sites\all\modules\webform_vbo\views\webform_vbo.views.inc

function webform_vbo_views_data_alter(&$data) {

  $data['webform_submissions']['views_bulk_operations'] = array(
    'title' => t('Webform'),
    'group' => t('Bulk operations'),
    'help' => t('Provide a checkbox to select the row for bulk operations.'),
    'real field' => 'nid',
    'field' => array(
      'handler' => 'webform_vbo_bulk_operations_handler_field_operations',
      'click sortable' => FALSE,
    ),
  );
}

the 'webform_submissions' view, which comes standard with the installation of Webform, is referenced in the data array.
I was working on a custom view named 'kids_submissions', so the necessary field operations handler was not added.

If you want to work with a custom webform submissions view, created via /admin/structure/views/add, you practically need to alter this hook which is imho not the right approach.

A more generic alternative i came up with deals with the entity type determination hack a bit more more Drupalwise.
Instead of extending the by VBO provided views_bulk_operations_handler_field_operations class, i wrote an entity_info hook :

<?php
function webform_vbo_entity_info() {
  return array(
    'webform_submission' => array(
      'label' => t('Webform Submission'),
      'base table' => 'webform_submissions',
      'entity keys' => array(
        'id' => 'sid',
      ),
    ),
  );
}

which creates a new webform_submission entity type, allowing VBO to handle it by its own field operations handler.

Together with some other minor bugs, i got this webform_vbo module e2e working now.

When i find some time, i'll commit it to the sandbox project for further review and testing.

kevster’s picture

hi Rawdesk - that would be really useful - I could really do with this one working, happy to test/review when its ready...

RAWDESK’s picture

@kevster,

It will be something for the upcoming weekend to work on (too busy from Monday to Friday).
I'll additionally give you my real plan with this module :
Beside deletion of submissions, i would also like to introduce the well known VBO "Modify entity values" action.
Not based on real entity fields, but webform (submission) components.

Are you up to co-test this scope ?

Thanks upfront !

tip-ok’s picture

Hi RAWDESK, any chance to get webform_vbo for testing?

RAWDESK’s picture

Hello,

The urgency for the vbo actions availability has been lowered by my client, but it's still on the roadmap.
By the end of this month, i will start with further development on it.
Thanks upfront for your patience.

Regards

danchadwick’s picture

I would discourage any module name from starting with webform_. Suggest webformvbo instead. This avoids namespace clashes.

Unrelated to webform, I'm using vbo with a custom table using this:
http://drupal.stackexchange.com/questions/114364/adding-vbo-to-an-entity

RAWDESK’s picture

#UPDATE:
Issue has been set out-of-scope by my client, since discontinuation of Drupal as technology for their webpresence.

erbzh’s picture

Bulk delete submissions works with Webform (7.x-4.18), VBO (7.x-3.5) and Webform Entity (7.x-1.x-dev / 2 Nov 2015).
Bulk re-send emails should work too.

liam morland’s picture

Status: Active » Fixed

That sounds like the solution.

skylord’s picture

Hm. It looks like workaround but not as production-ready solution. I've worked a lot with WebformEntity - it's very buggy, still has not any release (even alpha or beta) and will be overhead if someone just wants to add mass operations support for webform results page.

liam morland’s picture

Status: Fixed » Active

OK

liam morland’s picture

Status: Active » Closed (outdated)

Drupal 7 is no longer supported. If this applies to a supported version, please re-open.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.