This is something I stumbled on completely by accident, however it turns out that it’s a cool use of the Search Box web part. Did you know that you could direct the Search Box web part to any page you wish, and it doesn’t have to be a standard SharePoint search results page? In this post I will show you how I configured it to send the search query to a page containing a Business Connectivity Services (BCS) list as the target results page.
Originally it only had tabs for All Sites and People, and recently we wanted to add a tab for Dealers. When users enter search criteria on the All Sites tab, they are taken to the standard results page in our Search Center, and when searching for people, they are taken to our people results page. However when searching for dealers, we wanted to redirect them to our Dealer Search results page which was created using the BCS (see figure 2).
The tabs were created using Christophe’s (@Path2SharePoint) Easy Tabs solution. The tabs for All Sites and People were built using the Search Box and People Search Box web parts respectively and configured to redirect to the proper search results page.
One idea I had was to create an HTML form web part for the Dealer Search box, that when submitted would take the user to our Dealer Search results page by passing the search terms through the query string (the BCS list is connected to a query string filter web part). Then I would have to try to style it the same way as the sites and people search boxes, and this looked like it would be a pain. I wondered if there was a way to simply utilize the Search Box web part for the dealer search by pointing it to our Dealer Search results page instead of the standard results page.
The only way to find out was to try it, and it worked! Following are the steps I took and configuration settings for the web part. Note: this is assuming that you have already created a results page with a BCS list that is populated via a query string filter web part (see figure 2 above). I won’t be explaining how I created the BCS list in this post as there are plenty of resources already out there.
- Add a Search Box web part to any web part zone on your page.
- Make sure to hide the scopes dropdown and default to the target results page, as below. Search scopes are irrelevant in this scenario, so you don’t want the scopes dropdown menu to appear. In addition, I left all the other options under Scopes Dropdown and Query Text Box at their default values, with the exception of the query text box width, as I wanted it to be wider, and I unchecked Append additional terms to query.
- In the Miscellaneous section, I left all the image URLs at their default values, but you may change if you wish (e.g. if you’re using custom images for your search boxes). I also made sure the four options below that were unchecked, and I changed the Target search results page URL to the URL of my Dealers BCS list page.
- I changed the Title and set the Chrome Type to “Title Only” since I’m using Easy Tabs. The title is what appears as the tab name. If you’re not using Easy Tabs you may wish to hide the title by selecting “None” or “Border Only.”
- Click OK and save/publish the page.
That’s it! Now when you type in a search term in your Dealers search box and click the Search button, you will be redirected to your BCS search results page!