Views exposed text filter set to required shows an empty error and form error on page load

Created on 15 September 2015, about 9 years ago
Updated 2 February 2024, 10 months ago

Problem/Motivation

Views page with exposed text filter set as required filter will show an empty error message and a form error for the required filter when first loading the page, before you actually have a chance to input anything

Steps to reproduce

A.
- Go to the Content admin view
- Make the title filter to required
- Look at the preview or go to the content admin page

B.
The issue also occurs if you have a filter entered, then click a Reset button.

Proposed resolution

Only show the error after searching without the required filter.

From @nrogers

I found this problem also occurred with a webform plugin we were using and decided hard coding the plugin id types was a bad idea. So I reworked the patch to just test for any input regardless of plugin type. I also moved the code outside of the reset button condition so that it works when the form does not contain a reset button. This does not cause the regression in #77 as it's looking at the form state for the input values instead of the view.

I also added a test to demonstrate the problem

Remaining tasks

Improve testing
Review

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Views 

Last updated about 11 hours ago

Created by

🇳🇱Netherlands Lendude Amsterdam

Live updates comments and jobs are added and updated live.
  • VDC

    Related to the Views in Drupal Core initiative.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024