Followup from #1268150: Ajax doesnt work with BEF Links.

AJAX and BEF links now work for single-select filter, but not multi-select filters (those with the "Allow multiple selections" option ticked).

Comments

mikeker’s picture

Category: Bug report » Feature request
chanac_hares’s picture

Hello
This feature is it integrated into the latest dev version ?

mikeker’s picture

@chanac_hares: no, that's why the issue is marked as "Active."

davorama’s picture

In includes/form.inc there is this at line 1371 (drupal 7.41):

        if (is_array($elements['#value'])) {
          $value = in_array($elements['#type'], array('checkboxes', 'tableselect')) ? array_keys($elements['#value']) : $elements['#value'];
          foreach ($value as $v) {
            if (!isset($options[$v])) {
              form_error($elements, $t('An illegal choice has been detected. Please contact the site administrator.'));

but if you have used BEF to convert a boolean to be a single on/off checkbox that only indicates
the 'on' state your $v in $options[$v] will be 0 and $options[$v] will not be set.

I've kludged my way around this by changing

if (!isset($options[$v])) {

to

if (!isset($options[$v]) && $v!==0) {

Which is not the right way to fix this but maybe this will help the maintainers
find a real solution?

geoffreyr’s picture

I'm working with a patched version right now that uses data-* attributes at the theme level to determine values and reset buttons for multiselect links. Would anyone be interested in this?

seemas’s picture

hello,geoffreyr. Im interested in your solution as long as I do not have some other better patch.

thanks.

brightbold’s picture

Thanks @mikeker for identifying this bug — I couldn't figure out why my filters were behaving so strangely so you saved me a ton of time. I worked around the problem by disabling multiple select; it would be great to get this fixed in the module.

ya-radmir-88’s picture

I'm installed the patch from other BEF issue Can't unselect link (#11). BEF Links and AJAX worked for multiple selections.

neslee canil pinto’s picture

Status: Active » Closed (won't fix)

Hi, there will be no more future development for 7.x branch. If you see this issue in 8.x, feel free to file an issue. Closing this as Closed(wont fix).