0

The search_in variable doesn't seem to be searching both fields in this select statement. So only results from the primary location are being returned I believed. I checked the entries and they do use the secondary field. The second field is a relationship, is that the issue? Thanks in advance.

<select name="work_office[]"  name="search_in" value="work_office|work_office_2" class="Textbox4">
    <option value="">&nbsp;</option>
                {exp:channel:entries channel="offices" orderby="title" sort="asc" dynamic="no" category="1" }


                    <option value="{title}&&"" >{title}</option>
                {/exp:channel:entries}
                </select> 
1

I mentioned this privately, but will mention it here again:

value="" is not a valid attribute for the <select> element in HTML. value="" is used with <option> elements.

You also have name="" twice on your <select> element. You should remove one (search_in).

About search_in, from the Solspace Super Search documentation:

This parameter allows your users to select which fields they which to search within. This field is paired up with the keywords field, and overrides default behaviour of searching within ALL searchable custom fields. Options are: title, custom_field_name, all, or a combination of title and any custom_field_name's, delimited by pipe character (|).

In other words, this field is often not used in a dropdown field, but rather in a hidden field in the search form, or as a parameter in the results template (the template using {exp:super_search:results}). You can use search_in if you're using a keywords field in your search form. If you're not, and instead are looking to search in a particular custom field (eg. you want to search for a title in a custom field called eg. work_office), then use

<select name="work_office">

or

<select name="work_office[]"> (if you want to send an array of data)

| improve this answer | |
  • Thank you, I made a mistake while preparing the code sample for the question, but fixed the parameter issues. We have two other keyword fields, but what we want is if the user makes a selection in work_office[] dropdown that it considers work_office_2 and work_office_3,etc. I get the concept of everything combining under the one keywords field I'm just not sure where to place those secondary fields. Even though we have keyword fields in the same search form they are not related like "first_name" for instance to the user's search. Hope that clears it up and thanks for your patience! – jsuissa Nov 17 '15 at 5:00

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.