SharePoint 2007 Design Tip: Create a custom search input interface

A common request is to alter the default look of the search input and button area to something that better matches a design or fits better in space that is available. When working with the default search, you are limited to the CSS classes provided to you and the layout that ships with SharePoint. It is possible to create your own search display by deploying a Feature. Note I am not referring to search results, just the search box area available on most SharePoint pages, generally located in the header section.

MSDN documents this process and the code they provide will nearly work as is. There are two changes that need to be done to their code in order for the Feature to function on your web site. Below are the changes and a few other tips and resources to help you.

*** NOTE: This is to modify the basic search for WSS. MOSS uses another Feature for search (OsearchEnhancedFeature) and if you do the following actions, your custom scopes will not appear in the drop down box. If you are not using custom scopes, or if you don’t want or use “All Sites” and “People” search scopes, you can use this method to adjust your MOSS search display. ***

  1. Open up the MSDN article.
  2. Complete step 1 and 2.
    1. Note the HIDDEN property and value in the Feature tag. Make sure you change the HIDDEN value to FALSE. We need to show the Feature. 🙂 Thanks to AC for this tip. This is not required, but you will more than likely want to show this Feature in your site Features list.
    2. Note the SCOPE property and value. This article has you set the Feature’s scope to WEB, which is fine. But you will have to activate this Feature for every site (and sub site) that needs to use the new search area. Depending on your setup, this may not be ideal. Other options for this value are Farm, WebApplication, and Site. The first two are self explanatory, and Site means site collection. Web means a single web site.
  3. Complete step 3.
    1. Note the sequence value. For WSS, 99 will work. For MOSS, you need to lower the value to 20. Thanks to AC’s book, Professional SharePoint 2007 Web Content Management Development: Building Publishing Sites with Office SharePoint Server 2007 (Wrox Programmer to Programmer) for this tip.
    2. Note the two properties the article has you add in. For a full list of possible properties you can use here, check out the SearchBoxEx Members and look under Public Properties.
  4. Complete step 4. Note that you can name the new file whatever you like, and store it in a sub folder. If you place the file in sub folder, you can easily identify your custom ASCX files and they won’t get lost in the jumble of the default SharePoint files.
  5. Step 5 is up to you. If you want to do the changes just like the article, follow this step. Otherwise, in your custom ASCX file, make any adjustments you like including dropping the table, using DIVs, adding custom text and images, etc. You can also specify custom CSS classes. Store your CSS properties in your site style sheet.
  6. Complete steps 6 and 7. Note, if you set the scope to Farm, you don’t have to activate the Feature. That happens automatically when you install the Feature.

That’s it! In a relatively short period of time you can create a custom search display for your site.

Alternatively, John Ross has blogged about another method using JavaScript. Check out his post here.

I have found a few more resources online, here they are in case you want to learn/do more:
Project to customize the small search control in SharePoint 2007
Redirect Contextual Search Results to Search Centre Results Page
Search Results Page may be different per Search Scope

10 thoughts on “SharePoint 2007 Design Tip: Create a custom search input interface”

  1. Dear Heather,Very nice solution.The only weird thing that happens is that the searchscopes change to “this Site” and “This List”.In the site settings the scopes still show the options “All sites” and “People””.searching gives no results, but the error :”Your search cannot be completed because this site is not assigned to an indexer”

  2. Thanks Heather! Just figured this one out as well. Turns out the sequence 99 works *unless* you’ve installed MOSS as well as WSS, in which case there are already 2 delegate controls you have to get “under” in sequence. I think 25 is the number I ran into.Great info thanks!

  3. Marja- I updated my post to clarify that is is best suited for WSS sites. Check out the added URLs at the end for more info about your issue. I did not run into any issues executing a search after doing this, I would suggest you look into alternative causes for your search error.

  4. Found the other delegate control sequence numbers: ContentLightUp: Sequence = 100 OsearchBasicFeature: Sequence = 75 OsearchEnhancedFeature: Sequence = 25

  5. To Marja’s post. I am having the same issue. I have found NOTHING on the web to solve this delima. I need my Scope to show up and I only get This Site, This List. It must be something simple since no one has posted any suggestions about how to fix this issue.

  6. Thanks for this post Heather. A question I have though:Step 3 b you say “Note the two properties the article has you add in. For a full list of possible properties you can use here, check out the SearchBoxEx Members and look under Public Properties. “We are no longer using a SearchBoxEx control though, we are using a SearchArea control, and the public properties are very different. Check them out at correct me if I’m wrong, but the majority of the SearchBoxEx properties will obviously not work (unless there are properties also used by SearchArea).

  7. Marja & self-made…I am having the same issue.I too am getting ‘This Site’ and ‘This List’ as the scope filters. I am sure it has to do something with the Sequence number.

  8. Dear Heather, I am very new to sharepoint and its designer. I am using default.master page content to build my own site but with a different look and feel. My problem is, There is no such folder in 12 like Program FilesCommon FilesMicrosoft Sharedweb server extensions12TEMPLATEFEATURES. I jus have BIN. What can be other way to get my own design for search box??

Comments are closed.