Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Hiding the SharePoint Search Scope Dropdown List


By:   |   Read Comments   |   Related Tips: > Sharepoint

"SQL Server in The Cloud" - click to register for this free webcast


Problem

Many SharePoint portals require you to remove or hide the default search scope drop down list.  In this tip we cover the steps you can take to do this.

Solution

We have many alternatives to fix this issue:

Entire Farm

If you want to remove or hide the search scope drop down list for the entire farm (i.e.: For any Site - Not recommended) go to the below path:

	C:\Program Files\Common Files\microsoft shared\Web server extensions\12\Template\features\OSearchEnhancedFeature\SearchArea.xml

Then open the "SearchArea.xml" file and add the following tag element to hide the drop down list:

<Property Name = "DropDownMode"> Hide Scope DD</Property> 

Then go to the below path:

C:\Program Files\Common Files\microsoft shared\Web server extensions\12\Template\features\OSearchBasicFeature\SearchArea.xml

Then open "SearchArea.xml" file and search for the below tag:

<Property Name="DropDownMode">ShowDD</Property>

And replace "ShowDD" with "Hide Scope DD".  After this do an iisreset (IIS recycle pool) so this will take effect.

Specific Site

If you want to remove or hide the search scope drop down list for a certain site (Recommended - There are Several Alternatives).

=> You can use SharePoint Designer / CEWP (Content Editor Web part) to add the below CSS Style:

<style>
select .ms-searchbox
{
display : none ;
</style>

Or

=> You can use SharePoint Designer to add the below JQuery:

$(document).ready(function(){
$(window).error(function(){
alert("Error");
});

$("select[id$='SBScopesDDL'] option:contains('Scope2')").remove();
$("select[id$='SBScopesDDL'] option:contains('This Site:')").remove();
});

Or

=> You can use SharePoint Designer / CEWP to add the below Java Script, where "ctl00_g_edb49d82_8042_45e7_b0f7_2fa3fbed4ae6_SBScopesDDL" is the Client rendered ID for the search scope drop down list. You can get this value via IE - Developer tool bar or the Firebug tool.

<script language="javascript" type="text/javascript">
var objDDL = document.getElementById("ctl00_g_edb49d82_8042_45e7_b0f7_2fa3fbed4ae6_SBScopesDDL");
if( objDDL ) {
objDDL.selectedIndex = 0;
objDDL.style.display="none";
}

Or

=> You can use SharePoint Designer to edit the master page and remove the default simple search box control.  Then add another new simple search box web part and right click on it to get the web part properties pane.  Then select "remove search scope " drop down list option item from the search scope section.

Next Steps


Last Update:


next webcast button


next tip button



About the author





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Email me updates 


Signup for our newsletter
 I agree by submitting my data to receive communications, account updates and/or special offers about SQL Server from MSSQLTips and/or its Sponsors. I have read the privacy statement and understand I may unsubscribe at any time.



    



Learn more about SQL Server tools