Take the 2-minute tour ×
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It's 100% free, no registration required.

I have this form

{exp:low_search:form collection="foo" query="{segment_2}" secure="no" search_mode="any" loose_ends="yes" result_page="test/"}

<label for="foo_gender">Gender:</label>     
<select class="span12" name="search:foo_gender[]" id="foo_gender" multiple="multiple">
    <option></option>
    {exp:channel:entries channel="genders" orderby="entry_id" sort="asc"}
        <option value="={gender}">{gender}</option>
    {/exp:channel:entries}
</select>

<button type="submit" class="btn btn-primary">Search</button>

{/exp:low_search:form}

In the database I have 3 entries

 Entry 1, foo_gender = Male
 Entry 2, foo_gender = Female
 Entry 3, foo_gender = Transgender

I tried selecting entry 1 and 2 and submit.

I got only 1 entry from the result, entry 1.

That search form was supposed to be returning 2 entries, entry 1 and 2

Why is this the case?

P.S

The output of {low_search_search:foo_gender[]} was "=Male|=Female"

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

Currently, Low Search only supports non-exact matching for the search:field parameters with multiple values only. Single value fields will work with the exact syntax. You could work around it in this case by making it a single value:

<select class="span12" name="search:foo_gender" id="foo_gender">
    <option value="">All</option>
    {exp:channel:entries channel="genders" orderby="entry_id" sort="asc"}
        <option value="={gender}">{gender}</option>
    {/exp:channel:entries}
</select>

Update

As of Low Search v2.2.0, this is now possible, with the exact="" parameter. Simplfied:

{exp:low_search:form exact="search:foo_gender"}

    <label for="foo_gender">Gender:</label>  
    <select name="search:foo_gender[]" id="foo_gender" multiple="multiple">
        {exp:channel:entries channel="genders"}
            <option value="{gender}">{gender}</option>
        {/exp:channel:entries}
    </select>

{/exp:low_search:form}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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