Stump the Panel » End Users and Information Workers

Search Box Web Part - Limit Only to Single List

(8 posts)
  • Started 3 days ago by chapmanjw
  • Latest reply from chapmanjw
  1. chapmanjw
    Member

    Hello,

    I would like to add a search box to the home page of a SharePoint site (in the page content) that is limited only to a certain SharePoint List. How can I do this?

    Thanks

    Posted 3 days ago #
  2. eric
    Moderator

    I created a web part for our users to use. I took this code and replaced the Sharepoint search control with my code. This could be modified to point to the specific list they need to choose from.

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function Search()
    {
    if (document.getElementById('Google').checked)
    window.open("http://www.google.com/search?q=" + document.getElementById('Search').value);
    else window.open("http://google.ourdomain.com/search?site=default_collection&client=us_frontend&output=xml_no_dtd&proxystylesheet=us_frontend&q=" + document.getElementById('Search').value);
    }
    // -->
    </SCRIPT>

    <table cellpadding="0" cellspacing="0" align="center"><tr>
    <td class="ms-sbcell">

    <INPUT TYPE ="Text" NAME="Search" class="ms-sbplain" alt="Enter search words" SIZE ="40" />
    </td>
    <td class="ms-sbgo ms-sbcell">
    <img title="Go Search" onmouseover="this.src='/_layouts/images/gosearch.gif'" onmouseout="this.src='/_layouts/images/gosearch.gif'" alt="Go Search" src="/_layouts/images/gosearch.gif" style="border-width:0px;" />

    </tr>
    <tr></tr>
    <tr>
    <td class="ms-sbcell">
    <label>
    <input name="radio" type="radio" id="Google" value="Google" checked="checked" />
    Google Search</label>
    <label>
    <input id="Our Google" type="radio" name="radio" value="US" />
    ECU Search</label>
    </td>

    </table>

    Posted 3 days ago #
  3. Or, in the SSP, you could create a new scope that consists of just that one list.
    Then, you could use that scope in your search box.

    Laura Rogers

    Posted 3 days ago #
  4. chapmanjw
    Member

    Laura,

    I have created the scope, how can I make a search box that defaults to that scope? I need to add a search box in a way that doesn't require my users to think...

    Thanks,

    John

    Posted 3 days ago #
  5. chapmanjw
    Member

    I ended up taking Eric's suggestion, but modified it a bit. I created a scope and had the JavaScript redirect the page to that:

    <table cellpadding="0" cellspacing="0" align="left"><tr>
    <td class="ms-sbcell">
    <input type="Text" name="SearchBox" class="ms-sbplain" alt="Enter search words" SIZE ="40">
    </td>
    <td class="ms-sbgo ms-sbcell">
    <input type="image" src="/_layouts/images/gosearch.gif" name="SubmitSearch" onclick="parent.location.replace('/searchcenter/Pages/Results.aspx?s=SCOPENAME&k=' + document.getElementById('SearchBox').value)" >
    </tr>
    </table>

    Posted 3 days ago #
  6. chapmanjw
    Member

    Ok, now I am having a heck of a time with this in FireFox.

    This code works perfect in IE, however in FF it hangs and says please wait while the scripts load:

    <table cellpadding="0" cellspacing="0" align="left"><tr>
    <td class="ms-sbcell">
    <input type="Text" name="SearchBox" class="ms-sbplain" alt="Enter search words" SIZE ="40">
    </td>
    <td class="ms-sbgo ms-sbcell">


    <img title="Go Search" onmouseover="this.src='/_layouts/images/gosearch.gif'" onmouseout="this.src='/_layouts/images/gosearch.gif'" alt="Go Search" src="/_layouts/images/gosearch.gif" style="border-width:0px;">

    </tr>
    </table>

    Any ideas?

    Posted 2 days ago #
  7. In Site Settings, Site collection admin settings section:
    Click "Search Scopes"
    Click the link that says "Search Dropdown"
    This will let you change the order and the default scope.

    Laura Rogers
    http://spinsiders.com/laurar

    Posted 2 days ago #
  8. chapmanjw
    Member

    Laura,

    The default site scopes apply to the whole site collection, not just one particular site (which is what I need).

    I did finally figure out a working solution:

    <TABLE cellSpacing=0 cellPadding=0 align=left>
    <TBODY>
    <TR>
    <TD class=ms-sbcell><INPUT class=ms-sbplain id=SearchBox alt="Enter search words" size=40 name=SearchBox> </TD>
    <TD class="ms-sbgo ms-sbcell"><'A id=SubmitSearch title="Go Search" href="javascript:window.location.replace('https://ubs.sharepoint.asu.edu/searchcenter/Pages/Results.aspx?s=SunSET%20Search&k=' + encodeURI(document.getElementById('SearchBox').value));"><IMG onmouseover="this.src='/_layouts/images/gosearch.gif'" title="Go Search" style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px" onmouseout="this.src='/_layouts/images/gosearch.gif'" alt="Go Search" src="https://ubs.sharepoint.asu.edu/_layouts/images/gosearch.gif"> </TD></TR></TBODY></TABLE>

    Posted 2 days ago #

RSS feed for this topic

Reply

You must log in to post.