I have a grouped filter in a view with lets say 3 items. For the Widget i choose Radios and Allow multiple selections. For 3 Items everything works fine and i have some checkboxes. Wenn they are more then 3 items instead of checkboxes there is a select list! But i want to have checkboxes. Even Better Exposed Filters only shows select as an option for that filter. Whats wrong ?

enter image description here

  • I have the same problem and have been trying to dig thru the Views code that contains this logic - so far no luck
    – Brian
    Jan 28 '14 at 18:02
  • I think this issue handled your case: drupal.org/project/drupal/issues/2862200
    – yunzen
    May 6 '20 at 10:25

I came up with writing a simple hook:

 function  MY_MODULE_form_views_exposed_form_alter(&$form, &$form_state, $form_id)
    if ($form['#id'] == 'MYFORMID') {
      $form['field_MY_VALUE_FIELD']['#theme'] = 'select_as_checkboxes';
  • Alternative: $form['field_MY_VALUE_FIELD']['#type'] = 'checkboxes';
    – jaltek
    Aug 5 '15 at 8:01

The code that handle this conditional change between a multiselect and individual checkboxes is in views_handler_filter.inc in the function group_form:

    if (count($groups) < 5) {
      $form[$value]['#type'] = 'checkboxes';
    else {
      $form[$value]['#type'] = 'select';
      $form[$value]['#size'] = 5;
      $form[$value]['#multiple'] = TRUE;

Since it cannot be manipulated with any views options, the best way to handle this is to hook alter the form and just force it to always be checkboxes (or select if that's what you want).

This is suggested by the user "oll", but I don't see the need to change how the element is themed. You just need to change the type.


I have the same problem, but I can get up to four items. My workaround was to just add more grouped filters, making sure to use the OR grouping.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.