Forums › Forums › Search & Filter Pro › Reset Filter when select another
- This topic has 6 replies, 2 voices, and was last updated 6 years, 11 months ago by Trevor.
-
Anonymous(Private) January 13, 2018 at 1:06 am #152315
Hey,
I have set up a filter with category and tag forms. The user should only select a Category OR a Tag. In the settings I selected field relationships = OR. But when the user has a category filter set and then set a tag filter, the results shows the posts with the tags in this category. Is it possible to reset the filter, when the user select a category or tag?
Marvin
Trevor(Private) January 13, 2018 at 9:10 am #152325This is not a feature of our plugin, but is possible (with third party coding) via the use of javascript that checks the onchange of both fields. When one changes, it return the other to default. I do not have a code snippet for you, but you might well find something you can use on stackexchange.
Anonymous(Private) January 14, 2018 at 12:29 pm #152422Thanks for your help! I just solved it with this code:
$('.sf-input-radio[name="_sft_post_tag[]"]').click(function() { $('.sf-input-radio[name="_sft_category[]"]').removeAttr('checked'); $('.sf-input-text').removeAttr('value'); }); $('.sf-input-radio[name="_sft_category[]"]').click(function() { $('.sf-input-radio[name="_sft_post_tag[]"]').removeAttr('checked'); $('.sf-input-text').removeAttr('value'); }); $('.sf-input-text').change(function() { $('.sf-input-radio[name="_sft_category[]"]').removeAttr('checked'); $('.sf-input-radio[name="_sft_post_tag[]"]').removeAttr('checked'); });
-
AuthorPosts