I've come to face this issue time and again and I haven't yet found a solution without having to compromise something.

This scenario applies both to admin and front end.

There seems to be a lack of an efficient way to filter Entities according to some of their properties and/or fields.

In my example I'll use Users as my entity.

In multiple occasions I've had to filter users. Either to reference them to a node (entity reference), or to perform a bulk operation (front end - invite them to something or send them an email, doesn't really matter). The requirement would be pretty much the same: A view-like presentation with exposed filters that would allow for an operation to be performed to the selected Entities.

I am aware of Views Bulk Operations but even that lacks flexibility in this aspect, as it "resets" the form in each trigger of the exposed form.

If, I wanted to send an email to all the "Johns" and "Marys" on my user base, I'd have to filter against "John", select the users that are presented to me, and then filter against "Mary", select all the users that are presented to me, again, and then, either press the submit button or reset the filter to preview my selection.

Thing is that after the (ajax or not) exposed filter submission, the "John" checkmarks are lost, and if I Clear the exposed form, so are the "Mary" checkmarks.

The exposed form submission simply fetches a "fresh" view-form with it's rows filtered accordingly.

On the backend (entity reference) there seems to be some work by the entityrefence_view_widget module but it's still in the makings.

My question would be: How do you tackle such an issue when you face it in your projects? Is there a way I am not aware of?

  • For your VBO view, for each filter have you tried setting "Remember the last selection"?
    – Webdrips
    Oct 24, 2012 at 20:29
  • where would that setting be located please?
    – user5005
    Oct 25, 2012 at 7:05
  • I found the setting you are talking about but that seems to just maintain the filters' value.
    – user5005
    Oct 25, 2012 at 7:12
  • drupal.org/node/1821698 can't be done with VBO.
    – user5005
    Oct 25, 2012 at 8:57

1 Answer 1


Customized as it may be, it worked:

Using VBO and performing a hook_form_alter onto the exposed filter form I was able to add a hidden field.

Using javascript, I store the values of the selected entities (derived from the checkboxes attributes) into the hidden field. If the user triggers the exposed form submission, the values remain and on the new page load I use the same values to recheck the checkboxes thus providing the illusion that the values got preserved.

Downside is the unavoidable use of javascript and the possible huge URL.

If anyone has anything better to propose or make the exposed form NOT place it's parameters as $_GET parameters in the url I'd be glad :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.