SNAGHTML6b48e8bI recently wanted to change the default text that appears in all search boxes.  By default it shows “Search this site…” and I wanted it to be a little more customized to our environment.  It turns out this is very simple to accomplish, and no code!  We just need to edit 2 XML files.

 

We need to edit the SearchArea.xml files in 2 features to make this work in the 14 hive.  They are located at:

    1. %14%\Template\Features\OSearchBasicFeature\
    2. %14%\Template\Features\OSearchAdvancedFeature\

First, be a good safe SharePoint administrator by making a backup copy of each file before you change anything.  Once you do, edit the Searcharea.xml so we can add a property to make the magic happen.  After the last <Property> tag above <Control>, insert a new line, and insert the following:

<Property Name="QueryPromptString">Your Desired Text</Property>

Where Your Desired Text is obviously the text you want it to say inside the search box.  Like this:

SNAGHTML6a9d2ea

Do the same in the other feature directory and save.  Now you have to do an IISRESET and then take a look at your work.  Basically what we are doing is overriding the delegate control SmallSearchInputBox.  This delegate control is loaded in the master page at:

<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox" />

This delegate control then gets its definitions from the XML files above.  If you wanted ensure that this wasn’t overwritten by a service pack or CU update, you could create a new control using Visual Studio and use a lower sequence number which is defined in the XML definition.