[Filter Bar + TEC Pro] Bug deselecting “additional field” filters
-
Bug when attempting to deselect filter items. Yes, plugins up-to-date, no conflicts etc…
The criteria to reproduce this behavior is fairly specific:
- Create an “Additional Field” filter
- Additional field is type “checkbox”
- Set filter display to type “checkbox”
- Filter item must contain a space
" "
in it’s name. e.g. “Not deselecting”
Example values:Works
Doesn't work
Success
Not successful
Problem/Issue:
Trying to deselect a selected filter that matches the criteria above fails and remains active (field remains checked after ajax success, filter still set in URL params). Can only clear the set filter by resetting all filters.
Expected result:
Filter deselects and URL param is removed to match behavior of other filter types or filter items that don’t contain a space in it’s value.Troubleshooting:
It looks like the issue might be related to the regex/logic or URL encoding in js functionobj.removeKeyValueFromQuery()
:~/the-events-calendar-filterbar/src/resources/js/views/filters.js
In the meantime, I came up with a solution going a different route and leveraging template overrides to avoid the need to modify any js.
Basically, just needed a string replace for the input value (" "
w/"+"
).Probably not the best solution, but wanted to share this issue on the public forums in case this helps anyone else experiencing this.
Potential solution: In my case, I was able to resolve by overriding view:
~/the-events-calendar-filterbar/src/views/v2_1/components/checkbox.php
on line31
-
change:value="<?php echo esc_attr( $value ); ?>"
+
to:value="<?php echo esc_attr( str_replace( ' ', '+', $value )
); ?>"
…and now the filter item clears as expected. Not sure if string replacing spaces for the input values comes with any side effects, but so far so good on my end.?
Hope to see a release containing a more solid solution addressing this bug in the near future by TEC devs.
??</img>The page I need help with: [log in to see the link]
- The topic ‘[Filter Bar + TEC Pro] Bug deselecting “additional field” filters’ is closed to new replies.