0

I'm trying to filter using supersearch and checkboxes. Multiple checked checkboxes should create a get parameter like &myfield=value1&&value2. However, when I submit the form it escapes characters and fails to work.

Here's the bit of code with the checkboxes. It's a bigger form, but isolating this block won't work either:

<form method="get" action="/destinations/search">
    {exp:super_search:search}
    <fieldset class="amenities">
        <h3>Filter by feature</h3>
        {exp:low_options:amenities}
        {options}
        <span>
            <input type="checkbox" name="amenities[]" value="{option:value}">
            <label>{option:label}</label>
        </span>
        {/options}
        {/exp:low_options:amenities}
    </fieldset>
    <input type="submit" class="update" value="Update results">
    {/exp:super_search:search}</form>

The resulting url gives something like: ?amenities%5B%5D=barbecue&amenities%5B%5D=car-essentials

In the example I'm using low_options but I've also tried simply coding the fields. Am I missing something obvious? This is the last piece of a big project and has me scratching my head over and over.

Thanks in advance!!

Best, Santiago.-

2

Super Search works best as a POST form. GET forms are more limited. As mentioned in the docs (http://www.solspace.com/docs/super_search/post_get_or_template/):

GET does have it's limitations. As mentioned above, it is impossible to pass search arrays via GET.

Try using method="post" instead for your form.

| improve this answer | |
  • That solves it. I'm still trying to figure out of a way to chain the values this way: value1&&value2 instead of value1+value2, but I guess that's for another question. – Farmer1 Dec 11 '14 at 8:29
  • Try adding && after each of your checkbox values. Eg. value="toothbrush&&" – Solspace Dec 11 '14 at 14:29

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.