The search has a dropdown list, showing the categories I've created. It also has a free text search box to allow searching for company by name.
The problem is that I can't figure out how to add a generic 'all categories' or 'please select' option to the dropdown, allowing users to search in all categories. One of the categories always has to be selected.
This means that users searching for in Company X in the free text search field have to choose the category that Company X belongs to in the category dropdown, or Company X doesn't appear in the search results.
I'd like users to be able to choose a category OR type a company name (as well as combining the two search methods if they really want to).
Here's my Company Directory Search Form template code:
Code: Select all
{strip}
<div id="cd_searchform">{$formstart}
{* display any errors *}
{if isset($errors)}
<p class="errors">
{'<br/>'|implode:$errors}
</p>
{/if}
<h2>BROWSE BY CATEGORY</h2>
{cd_selcategory prefix=$actionid name='cd_category' selected=$cd_category}
<h2>or FIND COMPANY BY NAME</h2>
{* name substring search *}
<div class="row">
<input type="text" name="{$actionid}cd_name" size="40"/>
<input type="hidden" name="{$actionid}cd_name_type" value="LIKE"/>
</div>
<div class="row">
<input type="submit" name="{$actionid}cd_submit" value="{$mod->Lang('submit')}"/>
</div>
{$formend}</div>{* #cd_searchform *}
{/strip}