Problem/Motivation

When you expose a field of type boolean is always checked.

case 'bef_single':
          $show_apply = TRUE;

          // Use filter label as checkbox label.
          $form[$field_id]['#title'] = $filters[$label]->options['expose']['label'];
          $form[$field_id]['#return_value'] = 1;
          $form[$field_id]['#type'] = 'checkbox';
          break;

To reproduce yon can add new field boolean to content type article par exemple, and create new view with this field exposed as checkbox.

See older issue https://www.drupal.org/project/better_exposed_filters/issues/2618500

Proposed resolution

We need to assign correct value after submit.

CommentFileSizeAuthor
#5 2947281_1.patch2.25 KBfocus13
#2 2947281_1.patch2.25 KBfocus13
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

focus13 created an issue. See original summary.

focus13’s picture

FileSize
2.25 KB
focus13’s picture

Issue summary: View changes
nkoporec’s picture

Status: Needs review » Needs work

Hello @focus.I tested your patch and On/Off bug is fixed but you have one warning in a patch(warning: 1 line adds whitespace errors.
at line 39), so please fix it.

focus13’s picture

FileSize
2.25 KB
focus13’s picture

Status: Needs work » Needs review

@nkoporec i have fixed the warning. Thanks

nkoporec’s picture

Tested the latest patch from @focus13 and the patch error is gone.

rondog469’s picture

Just came across this today. Hopefully this gets committed soon!

nkoporec’s picture

Status: Needs review » Reviewed & tested by the community
Anys’s picture

#5 working great, thanks

  • rlhawk committed 8431131 on 8.x-3.x authored by focus13
    Issue #2947281 by focus13: Single on/off checkbox is always checked
    
rlhawk’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

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