2

I need the user to be able to search against two category groups: one for states, and the other for job type, i.e., accounting, HR, etc.

Two problems:

First, I try to use a placeholder value for my fields:

<select name="category[]">
<option val="">Select Category</option>
{exp:channel:categories channel="jobs" 
category_group="5" disable="category_fields"
style="linear"}
    {exp:super_search:variables}
        <option val="{category_url_title}">{category_name}</option>
    {/exp:super_search:variables}
{/exp:channel:categories}

(This is one of them.) The blank value ends up passing 'Select+Category' in to the URL.

Secondly, I need to ignore the keywords field altogether. I tried adding a hidden field:

<input type="hidden" name="keywords" value="">

But that doesn't matter.

My search results page is yielding incorrect results because it thinks the keywords value is "", which is like "any".

Try submitting the form: http://usesi.savagedevserver.com/jobs

Screencap

3
  • 2
    The correct attribute for the option element is value, not val. Try using <option value="...">. Commented Nov 1, 2013 at 13:25
  • What version of Super Search are you using? What version of EE are you using? Commented Nov 1, 2013 at 14:03
  • I fixed value vs. val. EE 2.7, SuperSearch 2.1.3. Commented Nov 1, 2013 at 18:27

2 Answers 2

3

For the first issue try changing <option val="">Select Category</option> to <option>Select Category</option>... specifically removing the val="".


I took a look at the Solspace Supersearch docs and I don't see that keyword is required. So try taking it out.

5
  • Thanks. Removing the val parameter from the option solved the first problem. However, it's still returning all results because it thinks keywords="". Commented Nov 1, 2013 at 4:47
  • 2
    Not having a value attribute in an <option> will submit the text inside the <option></option> itself. If you want to submit an empty string, use the attribute value="" instead. Commented Nov 1, 2013 at 13:28
  • Also, if you don't have a "keywords" field in your search form, no search will be done for "keywords", i.e. &keywords= shouldn't show up in your URL. Your results should be filtered by your selected categories only based on your image above. Make sure both select fields have name="category[]". Commented Nov 1, 2013 at 14:03
  • I removed <input type="hidden" name="keywords"> - but the problem happens with or without this field. Commented Nov 1, 2013 at 18:28
  • @Solspace = please see notes below - I've removed the keywords field and corrected category_indicator. This site launches soon, please advise. Commented Nov 6, 2013 at 21:25
1

Now that you have the search form looking better, try looking at your search results tag. Specifically,

category[] This field allows users to search on categories. Default behaviour is searching on category names. To switch this to category ID or URL titles, use the category_indicator parameter in the Results tag

Do you have the category_indicator parameter setup on your results tag?

3
  • I've added the category_indicator, but am getting the same result. Commented Nov 5, 2013 at 19:49
  • 1
    Please post an example of a URL that is failing so we can see what the search form is passing to the results page. Commented Nov 5, 2013 at 20:33
  • See usesi.savagedevserver.com/jobs and try a search. Commented Nov 5, 2013 at 23:09

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.