Filtering Webform Result Table Values in Drupal 7

Recently, the task has become - to make it possible to delete the results of web forms on Drupal 7 selectively, i.e. not completely clearing everything ... The task itself is dreary, especially since the operation bulk is not friendly to anyone in the views with the results of webforms, but only strives to delete the node completely, i.e. the form itself.

We got to the solution by installing the webform_submissions_multiple_delete module and displaying the IP address in it from the form result. To do this, I had to tinker with the module-file a little, adding to the 48th line

array('data' => t('IP'), 'field' => 'ip'),

in 70

$ip = $data->data;

in 75


Also, in line 59 add


In order to somehow limit the number of output lines, because with 20 thousand results, the page stupidly hung tightly when opened.

So, there is a table, but manually searching the browser page to search for spam IPs and putting checkboxes for a long time and not convenient, so after a long googling I found an option to insert an input and a script in front of the form, with which the table value will be searched and, if it matches, filtering - table rows that do not meet the search requirements will be hidden. Thus, we will only have those lines with checkboxes that we need to remove.

So, the script that does everything

    function myFunction() {
        var input, filter, table, tr, td, i, txtValue;
	input = document.getElementById("myInput");
	filter = input.value.toUpperCase();
	table = document.getElementById("DelTable");
	tr = table.getElementsByTagName("tr");
	for (i = 0; i < tr.length; i++) {
	  td = tr[i].getElementsByTagName("td")[4];
	  if (td) {
	    txtValue = td.textContent || td.innerText;
	      if (txtValue.toUpperCase().indexOf(filter) > -1) {
		tr[i].style.display = "";
	      } else {
		tr[i].style.display = "none";

And before the table itself we put the input

<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for value..." title="Type in value" />

As you can see, the script is accessing the id of the table, with which there was a problem, because. the bulk deletion table is generated by the module and it does not have its own template. You can add an ID for the filtering script with a spript

  $('table.table-select-processed').attr('id', 'DelTable');

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
The comment language code.