---
title: Displaying filters using alternative forms
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

You can use [alternative forms](https://docs.kentico.com/k9/configuring-kentico/creating-alternative-forms.md) to create filters for the records of forms, custom tables or page types.

> **Note:** Filtering alternative forms must always use the reserved keyword _**filter**_ as their **Code name**.

The filters are then displayed in the following parts of the Kentico administration interface:

- **Forms -> Edit a form -> Recorded data**
  - See [Creating a custom contact us form filter](#example---creating-a-custom-contact-us-form-filter)
- **Custom table data -> Edit a custom table**
- **Custom tables -> Edit a custom table -> Data**
- **Pages -> Listing**
  - See [Extending the page type listing filter](https://docs.kentico.com/k9/developing-websites/defining-website-content-structure/page-types/configuring-page-types/extending-the-page-type-listing-filter.md)

By default, list filters appear when the number of records is **25** or more. You can change this limit by adding the following key into the _appSettings_ section of your _web.config_ file:

```html

<add key="CMSDefaultListingFilterLimit" value="5" />

```

Filtering is possible based on all fields that store the following types of values:

- Text
- Boolean (Yes/No)
- Integer numbers
- Long integer numbers
- Decimal numbers
- Date & time

The required fields need to be displayed in the alternative form and an appropriate [form control](https://docs.kentico.com/k9/custom-development/developing-form-controls.md) must be assigned to each field. A filter form control is available for each data type:

- **Text filter**
- **Boolean filter**
- **Number filter**
- **Date & time filter**

Additionally, you can use the **Drop-down list** or **Radio buttons** form controls to create a filter based on option selection (for any field data type). When configuring the **Data source** setting for such a field, you can use the same options as in the original form field. However, we recommend adding a default option with an empty value that does not perform any filtering. For example:

```csharp

;(No filtering)
Value1
Value2
Value3

```

## Example - Creating a custom contact us form filter

The following example demonstrate how to create a filter for the **Contact Us** form on the sample **Corporate Site**. The same procedure can be used for any other form, custom table or [page type](https://docs.kentico.com/k9/developing-websites/defining-website-content-structure/page-types/configuring-page-types/extending-the-page-type-listing-filter.md).

> **Info:** In the default installation, the **Contact Us** form already has a pre-defined **filter** alternative form. You can just inspect its setting instead of going through the example.

### Adding the filter form

1. Open the **Forms** application.
2. Edit () the **Contact Us** form.
3. Switch to the **Alternative forms** tab.
   - There should already be a pre-defined **filter** form. Click **Delete** () so that you can go through the rest of this example and create your own filter from scratch.
4. Click **Create new form**.
5. Enter a **Display name**.
6. Type _**filter**_ into the **Code name** field _(filter_ is a code name reserved specifically for this purpose).
7. Select the **Make new fields hidden** check box.
8. Click **Save**.

### Configuring the filter fields

After you create the form, you need to modify the fields:

1. Switch to the **Fields** tab. In the listbox on the left, you should see all fields defined for the form. The first three are system fields and they are not needed in the filter, so you can leave them as they are.
2. Select the fourth field - **FirstName**.
3. In the **Field appearance** section, set the **Form control** to **Text filter**.

   ![Setting the form control for a filter form field](https://docs.kentico.com/docsassets/k9/displaying-filters-using-alternative-forms/Filter_Field_Form_Control.png "Setting the form control for a filter form field")
4. Click **Save**.
5. Repeat the steps 3 and 4 for the **LastName** and **Email** fields. This ensures that these fields are also included in the filter.
6. Disable the **Phone number** and **Message** fields by unchecking the **Display field in the editing form** option and clicking **Save** in both fields.

### Result

Once you have the filter created, return to the form's editing interface and select the **Recorded data** tab. You can try filtering based on various parameters.

![The filter defined by the alternative form](https://docs.kentico.com/docsassets/k9/displaying-filters-using-alternative-forms/Alternative_Form_Filter_Result.png "The filter defined by the alternative form")

> **Note:** **Note**: By default, the filter only appears if 25 or more records are present in the list. To see the filter, you either need to create at least 25 records, or use the **CMSDefaultListingFilterLimit** _web.config_ key to lower the filter limit accordingly.
