Using selects rather than checkboxes for category search
Hi,
I know that , as per the docs, I can use checkboxes on the results page to indicate the searched categories, using {if category_id IN ({low_search_category})} checked="checked"{/if}.
However, I need to provide an interface which allows two categories per group to be searched on, using two select elements, each like this:
{exp:low_search:filters query="{segment_4}"}
{exp:channel:categories style="linear" channel="organisations" category_group="10"}
{category_name}
{/exp:channel:categories}
{/exp:low_search:filters}
Of course, this means that both of the select menus have two selected options, where I need each to have one option selected.
Is this possible?
Replies
Low 11 Nov 2014 11:50
You can use whichever input field you'd like, including selects. As long as you make sure the name="" attribute contains the correct parameter name.
For two drop down fields, each targeting a different category group, you could use 2 select elements with name="category[]". To make sure that translates as option 1 AND option 2 (rather than OR), use require_all="category" on the Results tag. You can use the same IF statement as above for pre-selecting the chosen option for each select.