All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Creating advanced search form using fields

Wayne 29 Jan 2018 16:48 question, complete

Hi,

I'm trying to create an advanced search form that uses a selection of checkboxes, radio buttons and text fields as the search criteria.

I have a channel setup in EE that has a number of fields that I would like to be able to search on.

Core (radio buttons)
Free text (rich text editor)
Steel Encapsulated (checkboxes)
Top side (radio buttons)

I would like to create a form that has the above fields and options displayed.

core
radio value: High density chipboard
radio value: Reinforced Calcium Sulphate

Top side
radio value: HPL
radio value: PVC
radio value: Rubber

Steel Encapsulated:
Show entries that have this ticked

So if a visitor selects the following form options, the results page would list all entries that match.

core > High density chipboard
top side > PVC
steel encapsulated > checked

Is this sort of thing achievable with low search?

Regards

Replies

  1. Low 29 Jan 2018 17:01

    Yes, possible.

    Use the Field Search filter for the Radio buttons and checkboxes, use the Keywords filter for the rich text editor.

  2. Wayne 29 Jan 2018 17:19

    Great,

    How do I get the value of the subitted fields into the search filter?

    search:core="={low_search_search:core}"
    search:top_side="={low_search_search:top_side}"

    The above doesn't work, If I hard code the value in it works.

    Regards

    Wayne.

  3. Low 29 Jan 2018 17:21

    Use a Low Search Form, which generates an encoded query in the URI, then pass that segment to the Results tag in the query="" parameter. That will set those parameters automatically. Be sure to read this: http://gotolow.com/addons/low-search/...

  4. Wayne 29 Jan 2018 17:34

    Think I must be missing something.

    I have the following setup but no resutls are returned when I search.

    Search page


    {exp:low_search:form
    result_page="product-selector/results"
    }

    <label for="core">Core</label>

    {exp:low_list:each items="High density chipboard|Reinforced Calcium Sulphate" as="core"}
    <input type="radio" value="{core}" name="search:core"> {core}
    {/exp:low_list:each}

    <label for="top_side">Top side</label>
    {exp:low_list:each items="HPL|PVC|Rubber" as="top_side"}
    <input type="radio" value="{top_side}" name="search:top_side"> {top_side}
    {/exp:low_list:each}

    <button type="submit">Search</button>
    {/exp:low_search:form}


    Results

    {exp:low_search:results
    query="{segment_3}"
    search:core="={low_search_search:core}"
    search:top_side="={low_search_search:top_side}"
    channel="datasheets"
    }

    <h3>{title}</h3>
    <p>{low_search_excerpt}</p>

    {if low_search_no_results}
    <p>
    No results for “{low_search_keywords}”.
    </p>
    {/if}

    {/exp:low_search:results}

  5. Low 29 Jan 2018 18:43

    As mentioned here:

    parameters can be applied in two ways: as input fields in a Form, or as hard-coded parameters in the Results or URL tag


    (emphasis mine)

    You've got the parameters both in the Form and hard-coded on the Results tag. The latter overrules the former. Remove them from the Results tag -- they're set automatically because of the query="" parameter.

  6. Wayne 30 Jan 2018 11:05

    Thank you.