How to implement a search webpart for lists in Sharepoint 2003
Inleiding
The search function of Sharepoint 2003 can be quite vague and not user friendly. Sometimes you want to implement a (team)site specific search function. A nice feature would be a list specific search function.
This article will present you a free solution webpart for your Sharepoint. This is a solution that can be customized to your specific list or document library.
Stappen
- At first go to the page where you want your search module
- Click on Add webparts in the Site Actions Link right top
- Browse for a Content Module and insert it into your (team)site
- Now it's time to customize this module
- Click on the triangle on the webpart and click Modify Share Webpart
- Click on the Source Editor in the appearing Menu at the right
- Insert the following code:
<script language=javascript> function LeerWikiSharePointSearchWebpart() { var searchKey = document.getElementById("Held").value; var searchType = document.getElementById("wssHeader__ctl0_HeaderSearch1_headerSearchType").value; var searchUrl = document.getElementById("wssHeader__ctl0_HeaderSearch1_headerSearchUrl").value; window.location.href='....yourmainsite..../C5/SearchCenter/default.aspx?k=' + searchKey + "&type=" + searchType + "&url=....yourspecificsite.....";} function handleEnterKeyForSearchLeerWiki() { if (window.event.keyCode==13) { LeerWikiSharePointSearchWebpart(); return false; } return true; } </script> <table> <tr> <td class="ms-sbtable ms-searchform" style="PADDING-LEFT: 4px"> <p> <a accesskey="S" title="Advanced Search" href="javascript:LeerWikiSharePointSearchWebpart();"><img title="Advanced Search" alt="Advanced Search" src="/_layouts/images/SPSSearch2.gif" border="0" style="CURSOR:hand;" align="absmiddle"></a> </p> </td> <td style="PADDING-LEFT:4px"> <p> <input name="wssHeader:_ctl0:HeaderSearch1:headerSearchBox" id="Held" type="text" style="width:100px" maxlength="200" Class="ms-sbkeyword ms-descriptiontext" onkeypress="return handleEnterKeyForSearchLeerWiki();" value="" /> </p> </td> <td nowrap="nowrap"> <p> <img title="Execute search" alt="Execute search" border="0" alt="Execute Search" onmouseover="changeImages(this, '\/_layouts\/images\/icongo02.gif'); return true;" onmouseout="changeImages(this,'\/_layouts\/images\/icongo01.gif'); return true;" onclick="LeerWikiSharePointSearchWebpart();" src="/_layouts/images/icongo01.gif" style="CURSOR:hand" /> <input name="wssHeader:_ctl0:HeaderSearch1:headerSearchUrl" id="wssHeader__ctl0_HeaderSearch1_headerSearchUrl" type="hidden" /> </p> </td> </tr> </table>
- Dont forget to change the following code to your URL
*....yourmainsite.... --> basic site URL of your company (ie. http://portal.company.com)
*....yourspecificsite..... --> the specific site you want to search in .
(ie. http://portal.company.com/sites/procurement/teamsite/lists or http://portal.company.com/sites/procurement/teamsite/documents)
- Save the module and it should be working
Tips
- If some thing are not quite working, maybe your Sharepoint has some different URL variables. Your can always check with your standard Sharepoint SearchFunction to customize to your Company.
Handige links