Formidable Forms

Formidable Forms

  • Features
  • Pricing
  • Resources
    • Docs & Support
    • Blog
    • Community
  • Solutions
    • Web Applications
    • Calculators
    • Surveys
    • Directories
    • Payments
    • Contact forms
  • Login
  • Get Formidable Forms

Filtering Entries

Last Updated: June 27, 2021

Knowledge Base → Views → Filtering Entries

What is a filter? A filter allows you to display form entries that meet specific criteria. For example, if you had customers and employees give feedback on a product in a form, you could filter out the customers' feedback, leaving only the employees' feedback displayed in the View.

Formidable Forms is the best WordPress Form Builder plugin. Get it for free!

When filtering entries, you can apply multiple filters to a single View. The result will only display entries that meet all filters. For example, if you have the filters listed here...

Filter Example

...your View will only display entries where the Last Name is equal to "Doe" AND the First Name is equal to "Jane".

Basic filtering

If you would like to create a basic filter, you can do so by going into edit a View. Filtering options will be in the View builder with links for Filter entries and Sort entries. In order to create a filter, simply click the "+Add filter" button. This will create a new filter which you can customize to fit your needs.
View Filter Settings

Advanced filtering

It can be very helpful to filter Views based on parameters in the URL, the current user, date ranges, etc.

By Current User

If you would like to allow your users to see only their submitted entries, edit your View and click the Filter Entries link. Add a filter that says "User ID is equal to current_user". This will only work if you have a User ID field in your form.
Filter by User ID

Note: No entries would appear when using "OR" filter when filtering by current_user if the user was not logged in.

By Parameter

The ability to filter by a URL parameter is often used when creating advanced search forms. You may pass parameters to a View through the URL or through the View shortcode.

If you would like to filter entries based on a parameter, add a filter that says "Specific field is equal to [get param="param_name"]". By default, a filter will be ignored if the parameter is not set or if the parameter value is blank.
Filter by Parameter
If you would like to prevent entries from showing when the parameter is not set, you can add the default option to your filter like this: [get param="param_name" default="none"].
Filter by Parameter - Default

Note: All entries would appear when using "OR" filters when filtering by a [get] shortcode that does not exist.

By User ID

You may want to create a view that an administrator can select a User to filter entries by to only see the entries of a selected user. This is similar to filtering by parameter, because you will need a separate search form.

  1. Create a search form. This form will have a single User ID field, and will redirect to the view on submit. Set the Redirect to URL to yoursite.com/your-page/?my-user=[x] where x is the User ID field ID.
  2. Add this filter so that User ID fields will display as dropdowns on the front-end.
  3. Create a view from the form from which you want to view user's entries.
  4. Add a filter in the View builder that says "User ID is equal to [get param=my-user]"
  5. Publish the view.

Now you can select a User in the User ID search form and view their entries for a specific form.

By User Meta

If you have the Formidable Forms add-on for WordPress User Registration, you can filter a view by user meta stored in a user's profile. For example, if you have an "Age" field in your form and your user's have a user meta field for "Age" stored in their profile, you could add a filter like the following to only show results where the user's age matches the age stored in the entry:
Age is equal to [user_meta key=user_age]
Replace "user_age" with the appropriate key for the respective user meta from the user's profile.

By Date

You may filter entries by the date they were created or updated. You may also filter entries by a date field in your form. When filtering by date, you may use any date string that is accepted by the PHP strtotime() function. The following are commonly used date strings:

  • NOW: Get the current date and time. You can use [date format='Y-m-d H:i:s'] as an alternative.
  • 2016-01-31: Insert any date in the Y-m-d format.
  • Next Thursday: Get the date for next Thursday.
  • Last Monday: Get the date for last Monday.
  • first day of this year: Get the first or last day of the year, month, or week. Use 'first' or 'last', along with 'year', 'month', or 'week'. PHP requires English for turning phrases like this into a date.
  • +1 day: Get the date by going back or forward by day. Use + to go forward and - to go backward.
  • +1 week: Get the date by going back or forward by week. Use + to go forward and - to go backward.
  • +1 year: Get the date by going back or forward by year. Use + to go forward and - to go backward.
  • +1 week 2 days 4 hours 2 seconds: Get the date with any combination of weeks, days, hours, and/or seconds.
  • [date format='Y']-01-01: Get the first day of the current year without English. This example is the same as 2019-01-01. Or the first day of the current month is [date format='Y-m']-01.

If you would like to only show upcoming events, add a filter that says "Date field is greater than NOW". If you would like to show entries that were created in the past week, add a filter that says "Creation date is greater than -1 week". Please note that if you choose to filter by a specific date, you must use the "Y-m-d" date format in the View filter.

By Entry Status

If you have a a mixture of draft entries and complete entries, you may filter the entries by their entry status. By default, a View will include complete entries. You can filter by any of the following:

  • Draft or complete entry: This will include both drafts and complete entries.
  • Draft: This will include only draft entries.
  • Complete entry: This will include only complete entries.

Filter by Entry Status

If you want to display additional info in the view if the entry is a draft, you can use the [if is_draft] conditional.

Troubleshooting

When using filters, if you find that your entries are not being filtered correctly, here are a few things to check:

  • Check to ensure there are entries that exist which meet all filters.
  • If you are filtering from parameters in a URL, check the URL. Do the parameters appear and are they correct? If so, check if the parameters match up with the parameters set in your View filters.
  • If you are searching a checkbox or multi-select dropdown field, are you searching for any values between 1 and 9? If so, the entries will not filter properly due to the serialization that occurs for checkbox and multi-select dropdown field values when saved to the database.

If you have reviewed the above steps and are not able to solve the problem, please post in the help desk for further assistance.

No results on WPEngine

When many entries are included in the results, there is a possibility WPEngine servers will stop the query. When this happens, no results are returned and the view will display the 'No Entries' message.

To prevent this from happening, add this in your wp-config.php:

define( 'WPE_GOVERNOR', false );

Examples

Show entries for the upcoming week

Imagine you have a form that tracks appointments, and you want to show entries for the upcoming week. Simply add two filters: "Date field is greater than NOW" and "Date field is less than +1 week".
Filter Date

Show all entries submitted by due date

Let's say that you have a form that has a deadline, and you want to display all entries that were submitted or updated before the set deadline. You can do so by setting up your filters like this.
Filter Deadline

Show all entries created for current year

If you want to display all entries created in the current year, simply add a filter like this: "Entry creation date is greater than or equal to first day of January this year."
Filter Current Year

The entry creation date uses a date-time format, which means time is taken into account with the creation date. e.g. 2022-02-09 at 11:33 am

Filter by user group

This example filters by user meta to display the correct form entries. Let’s say you have a form that is shared between two groups, and you want to filter the entries accessed by each group. You can do this by following the steps below:

  1. Each user should have a group name saved in a custom field on the user profiles. If this isn't already saved, you can add it using a user registration or profile form.
  2. Add a hidden field in the form used for collecting entries for display.
  3. Set the default value to the group name from the user profile with the [user_meta] shortcode.
    View Filter Hidden field Group of Users
  4. In the View Builder → Filter Entries section, add a filter like the following. This will only show results where the user's group matches the group name stored in the entry.
    View Filter by Group of users

Advanced customizations

If you need to customize your View filters with PHP, you may use the frm_where_filter hook or the frm_filter_where_val hook. Please be aware that we do not recommend using custom PHP if you are not comfortable writing and debugging PHP.

If you want to build if statements in a View to check if the current user is the owner/creator of the entry, use the frmpro_fields_replace_shortcodes hook.

Related Topics

  • Advanced View Concepts
  • Create a View
  • View Settings
  • Basic filtering
  • Advanced filtering
    • By Current User
    • By Parameter
    • By User ID
    • By User Meta
    • By Date
    • By Entry Status
  • Troubleshooting
    • No results on WPEngine
  • Examples
    • Show entries for the upcoming week
    • Show all entries submitted by due date
    • Show all entries created for current year
    • Filter by user group
  • Advanced customizations
  • Related Topics
Categories
×

Categories

  • Installation & Getting Started
  • Account Management
  • Forms
  • Entries
  • Views
  • Styles
  • Importing & Exporting
  • Add-Ons
  • Extend Formidable Forms

Using WordPress and want to get Formidable Forms for free?

Get Formidable Forms Lite Now

You do not have permission to view this form. Maybe you need to log in?

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

Take on bigger projects Right Now

Get the tools you need to revolutionize your workflow and architect a masterpiece. Build the most advanced WordPress forms and actually use the data you collect in meaningful ways.

Get the most advanced WordPress form plugin and the only form builder with integrated Views.

Get Formidable Forms Now

Resources

  • Community
  • Affiliates
  • Contact
  • Free Online Form Builder

Top Features

  • Application Builder
  • Calculator Forms
  • Surveys & Polls
  • Quiz Maker
  • Form Templates
  • Application Templates
  • Directories
  • Donation Plugin

Company

  • About Us
  • Giving Back
  • Careers
  • Newsletter
  • WP Tasty
  • Nutrifox

Copyright © 2023 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.
Privacy Policy | Terms of Service | Sitemap

Join 300,000+ using Formidable Forms to create form-focused solutions fast. Get Started See User Reviews