Multi-Value Filtering on SharePoint Lists
James writes:
“I happen to come across your blog site and found it very interesting. I've been researching on how to customize the Form Web Part on a team site in Sharepoint 2003.
For example, I'm wanting to customize the form web part to have two inputs. One would be for 'First Name' and the other for 'Last Name'. The form web part will be connected to a custom list and will filter the list based on both first AND last name. I have been able to accomplish filtering a list with one input value but not multiple.
When I use Front Page 2003 I create the connection but it only gives me the option to select one column name from the form web part and match it with one column in the custom list. I've done research on the form web part and found that you can filter a custom list with multiple input fields but I cannot find out how. ...”
One way to accomplish filtering SharePoint lists using multi-value filters is to take advantage of the URL Protocol for SharePoint lists.
In this case, you would specify FilterField1=FirstName and FilterField2=LastName if those where the respective names of the columns you wish to filter. For example:
http://[server]/[site]/Lists/Contacts/AllItems.aspx?FilterField1=LinkTitleNoMenu&FilterValue1=Doe&FilterField2=FirstName&FilterValue2=John
The preceding example would filter a list based on the built in Contacts list template. Using this you can use a simple HTML form to perform a post using hidden form fields for the FilterField1 and FilterField2 values, and use text boxes for FilterValue1 and FilterValue2 fields. This does not use the Form Web Part, but it accomplishes multi-value filtering. The only way I've seen the Form Web Part provide multiple values is if the web part supports consuming them, which the Data View and List Web Parts do not. This Terraserver web part is an example of one that does.