Wednesday, December 17, 2014

How to remove language filter and Searh tip from an Advance Search Webpart of SharePoint 2010.

By default UI of a SharePoint Advance search Webpart is as follows :

However in so many scenarios we are not using other criteria except our Custom Manged Metadata properties. So in order to hide all these unwanted criteria, just add a content editor Webpart into this page and add below scripts :

<style type="text/css">

.ms-advsrchtips{
display:none;
}
TD.ms-advsrchText-v2 > SELECT[title='Result Type'] {
DISPLAY: none
}
TD.ms-advsrchText-v1 > LABEL[for*='_ASB_SS_rtlb'] {
DISPLAY: none
}
.bottom {
BORDER-BOTTOM: gray 2px solid; BORDER-LEFT: gray 2px solid; BORDER-TOP: gray 2px solid; BORDER-RIGHT: gray 2px solid
}
.box {
BORDER-BOTTOM: medium none; BORDER-LEFT: gray 2px solid; BORDER-TOP: gray 2px solid; BORDER-RIGHT: gray 2px solid
}
.box H2 {
PADDING-BOTTOM: 10px; BACKGROUND-COLOR: gray; PADDING-LEFT: 10px; PADDING-RIGHT: 10px; COLOR: white; PADDING-TOP: 10px
}
.box DIV {
COLOR: #333
}
.box {
-moz-border-radius-topright: 5px; -moz-border-radius-topleft: 5px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px
}</style><script language="javascript" src="/sites/IAIC/Style%20Library/CPA/jquery-1.8.1.min.js"></script><script language="javascript" type="text/javascript">

ExecuteOrDelayUntilScriptLoaded(function () {

$(".srch-advancedtable").wrap("<div class='content'></div>");$(".content").wrap("<div class='box'></div>").before($('content'), "<h2>Search Client Data Here</h2>");;$(".content").after('<div class="bottom"></div>'); 
    }, 'sp.js');</script>

After adding above script. Advance Search Webpart will look like below :