Validation errors of extra options form are muted

Created on 6 August 2020, about 5 years ago
Updated 22 August 2025, 8 days ago

Problem/Motivation

\Drupal\views\Plugin\views\HandlerBase exposes these methods:

public function buildExtraOptionsForm(&$form, FormStateInterface $form_state) {}
public function validateExtraOptionsForm($form, FormStateInterface $form_state) {}
public function submitExtraOptionsForm($form, FormStateInterface $form_state) {}

Allowing and "extra options" form. In core there are only 2 filters from Taxonomy module using this. The form works and, on validation errors, the form is not submitted. The problems is that the errors are not displayed anywhere. This is confusing for site builder because they might think that the submit has been successful.

Steps to reproduce

TBD

Proposed resolution

Make the validation error displayable.

Remaining tasks

- Provide clear steps to reproduce this issue

User interface changes

Show the validation error to the user.

API changes

None.

Data model changes

None.

Release notes snippet

None.

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡·πŸ‡΄Romania claudiu.cristea Arad πŸ‡·πŸ‡΄

Live updates comments and jobs are added and updated live.
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.

  • First commit to issue fork.
  • Pipeline finished with Failed
    8 days ago
    Total: 794s
    #578794
  • πŸ‡¨πŸ‡¦Canada tame4tex

    So this ended up being a simple fix. ConfigHandlerExtra::validateForm was missing the code to instruct ajax to re-render the form so that error messages are included. Specifically:

        if ($form_state->getErrors()) {
          $form_state->set('rerender', TRUE);
        }
    

    I have added a test and fixed this bug. I have also updated the IS with the steps to reproduce and the proposed resolution.

  • Pipeline finished with Success
    8 days ago
    Total: 686s
    #578802
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Left 2 small comments on the MR.

    If you are another contributor eager to jump in, please allow the previous poster(s) at least 48 hours to respond to feedback first, so they have the opportunity to finish what they started!

  • Pipeline finished with Success
    7 days ago
    Total: 639s
    #579563
  • πŸ‡¨πŸ‡¦Canada tame4tex

    Thank for the review smustgrave!

    Resolved one comment and added justification for the new test class in a reply on the other comment. Back to NR.

  • Pipeline finished with Success
    6 days ago
    Total: 1035s
    #579580
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    So I tried to follow the steps in #8 but the tags field is using radio buttons so something is always selected. Are there other steps?

  • πŸ‡¨πŸ‡¦Canada tame4tex

    @smustgrave I have updated the IS which explains and highlights the need for the patch file to enable manual testing. I have also added extra details on where this bug is being encountered.

Production build 0.71.5 2024