Advanced Search Web Part – using drop down lists instead of plain text boxes

I’ve wanted to use dropdown lists in the advanced search property restrictions for a long time, so i created a web part to allow it (SearchExtension web part). It can be found on codeplex:

How it works:

  • On page load the web part locates the advanced search box and passes its client ID to the client-side in javascript
  • On the DOM ready event, javascript uses the clientID to find the proprety restriction dropdown lists, and adds events to them
  • The events are triggered when the selected property changes, and cause the plain text box to be hidden, and a drop down list created and displayed in its place. The dropdowns created will pass their selected value to the orginal (hidden) text box which used to be there
  • Dropdown list values are populated using callbacks from SharePoint lists or can be defined static (defined in the configuration XML of the SearchExtension web part)
  • Two properties can be linked as parent/child – eg for “Category” / “Sub-category” scenarios
  • The javascript is cross-browser (IE6+ & recent versions of other browsers: FireFox, Chrome, Safari – earlier versions untested)

Please see the codeplex site for more information.


8 thoughts on “Advanced Search Web Part – using drop down lists instead of plain text boxes

  1. Hi,

    I have performed the following in an attempt to deploy your solution.
    1) Upload the downloaded file to solution gallery – so far so good.
    2) When I try to activate the solution I receive the following error:
    This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution ‘af333e6d-4219-456b-a164-3ce1458772c9’ failed validation, file manifest.xml, line 3, character 61: The ‘ResetWebServerModeOnUpgrade’ attribute is not declared

    Any ideas?



  2. Hello. I’m very interested in your web part. I’ve deployed it and attempted to configure it to look at a local list called “Relationship Manager” for the choices, but it’s not working. Here is the XML I tried:

  3. This solution appears to do exactly what I need, but I’m having no luck getting it to work. I’ve got the solution deployed & activated, and I’ve placed the webpart on my search page right above the Advanced Search box. Regardless of what I put in the configuration XML, though, it has no visible effect on the Advanced Search box.

    1. Hi Omegacron, please send me your configuration XML. Also, are there any script errors on the page? IE: Tools > internet options > advanced > Display a notification about every script error.

      The following are required (see the docs here:
      (*) Root node “Configuration” is required.
      (*) CustomPropertyRestrictionControls node is required even if empty it must be included.
      (*) SecurityTrimmings node is required even if it is empty it must be included.

  4. Now that I have the solution working, it is fantastic! Does exactly what it’s supposed to, and I love the flexibility of using hard-coded XML values or a list in Sharepoint. Thanks Ryan!

  5. Thanks Ryan for sharing this and also for providing support to get it working correctly.
    Selecting properties from dropdown menu in the property restrictions resolved a major headache for our end users and helped drive SharePoint adoption.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s