Double exposed filter field when trying to use "q" as identifier

Created on 13 February 2018, about 7 years ago
Updated 28 August 2023, over 1 year ago

Problem/Motivation

While creating a View, you can expose filters to your users. For each of these filters, you can choose the identifier it's going to use to pass the data in the URL. When you use the identifier "q", the filter field is duplicated and doesn't work anymore. As "q" used to be reserved by Drupal to manage it's own URL, it can be understood. The thing is that the identifier field allows to use that letter and gives absolutely no clue on what's going wrong when you do it.

Steps to reproduce

  1. Install Drupal standard
  2. Go to Views UI (admin/structure/views)
  3. Edit any View
  4. Add any filter
  5. Make it exposed
  6. Change it's identifier to "q"
  7. Look at the preview

Expected: the exposed filter appears and work properly
Current: a duplicated field appears before the exposed filter and the filter doesn't work at all

Proposed resolution

Add a message in the identifier field description to indicate that "q" is a reserved word and cannot be used.
Validate the identifier field to ensure the entered value is not "q".

Remaining tasks

Patch
Test
Review
Commit

User interface changes

Before

After

API changes

None.

Data model changes

None.

🐛 Bug report
Status

Fixed

Version

11.0 🔥

Component
Views 

Last updated about 1 hour ago

Created by

🇫🇷France duaelfr Montpellier, France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

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