- Issue created by @Ujjval Kumar Jha
When creating a view with an exposed filter (such as a select dropdown) and marking it as "Required", Views forces a default value to be set. This breaks the desired functionality where the form should initially display an empty "Select..." option and not show any results until the user actively selects a value.
For example, if we create a select field with:
- (Empty option) Select City
- City 1
- City 2
...and mark it as required, Views demands that a default value be provided. Once a default is set (e.g., City 1), the exposed form loads with City 1 preselected and results filtered accordingly, instead of waiting for user input. This prevents the form from behaving like a proper required filter.
This issue makes it impossible to build user-friendly, truly required filters that don't show results until a user makes a conscious choice.
1. Create a View with an exposed filter using a select field (e.g., taxonomy or list field).
2. Enable the "Required" checkbox for the exposed filter.
3. Try to save the view without setting a default value â Views throws a validation error requiring a default.
4. Set a default value (e.g., City 1) to proceed.
5. Load the View page â the form loads with City 1 preselected and filtered results displayed, even though no user input occurred.
Allow required exposed filters to without default value
Active
10.5 âš
views.module
Involves, uses, or integrates with views. In Drupal 8 core, use the âVDCâ tag instead.