Wednesday, February 13, 2008

SP2007: The Advanced Search Link

To have the Advanced Search link appear next to the seach box in the upper right hand corner of your pages you must be using the custom scopes option for the site collection. To do this go to Site Actions, Site Settings, Search Settings and set the custom scopes option following the example. This will make the Advanced Search link appear, and it links to the advanced.aspx page in the Pages library.

If you want to remove the Advanced Search link, but want to keep the custom scopes option, read on...

For reasons of design it is common to want to remove the Advanced Search link and move it to the search results page. Unfortunately there are no settings that allow you to turn this link on and off provided you want to stick with the custom scopes option. Some tutorials will instruct you to replace the search control with your own custom one, but that is complicated and messy. The easiest option is to simply hide the link. This can be done in two ways.

You could add a javascript to your master page to set the inner html of the link to nothing. Create a function and then run that function from the body tag. Something like the following should work:

function hideadvancedsearch() {
document.getElementById('ct100_PlaceHolderSearchArea_ct101_S6AE27B38_AdvSearchLink').innerHTML=" ";
}

While this will hide the link, the spacing will still be off. A cleaner approach is to use your style sheet to set the display property for the table cell to none which will completetly hide that cell of the table.:

.ms-blink
{
display:none;
}

You may also want to set the sbLastcell to none to force the search box to align on the right

.ms-sbLastcell
{
display:none;
}