0

I'm using the Solspace Supersearch add-on and am trying to search entries based on a checkbox field. Currently I'm getting all entries within the results. I've tried using name="users-exact" and this doesn't help to filter the returned data either. Suggestions appreciated, Thanks!

<form method="post" action="{path='search/results'}/">
    {exp:super_search:search}
    <input type="hidden" name="csrf_token" value="{csrf_token}" />
    <input type="hidden" name="inclusive_keywords" value="no" />
    <input type="hidden" name="redirect_post" value="no" /> 
    <label><input type="checkbox" value="Under 16" name="users[]"/> Under 16</label>
    <label><input type="checkbox" value="16-18" name="users[]"/> 16 - 18</label>
    <label><input type="checkbox" value="18 and over" name="users[]"/> 18 and over</label>
    <label><input type="checkbox" value="Women" name="users[]"/> Women</label>
    <label><input type="checkbox" value="Men" name="users[]"/> Men</label>
    <input type="submit" name="submit" value="Search"/>
    {/exp:super_search:search}
    </form>

{exp:super_search:results channel="zoo_visitor" inclusive_keywords="no" status="Services-id5"}
    <a href="{site_url}directory/view/{if visitor:member_id}{visitor:member_id}{if:else}{entry_id}{/if}">{firstname}</a>
    <p>{building}, {street}, {town}, {county}</p>
    {/exp:super_search:results}
  • That's only 1 half of the equation. What's the code for your results page? – Jeremy Nov 19 '14 at 2:15
  • ...and what version of EE and Super Search are you using? Also, what's the fieldtype of your {users} custom field? Is it set as searchable? Have you tried sending a string of data instead of an array (using name="users" instead of name="users[]")? – Solspace Nov 19 '14 at 8:59
  • See updated code for results page.The fieldtype is checkboxes and are set to searchable, setting name="users" also doesn't work, I've only got it to work using value="users-empty", however, this is not the output I need. Thanks. – Christian Rochford Nov 19 '14 at 10:12
0

I managed to solve the issue by allowing the use of keywords and using javascript to enter the checkbox values into a hidden supersearch "keywords" input. While I still don't know why the checkbox inputs are not filtering the results, this approach is giving me the correct output. Thanks!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.