Problem/Motivation

It is not possible to select a different value when using a select widget with required fields in the configuration.

Steps to reproduce

- Add a plugin_reference type field to the entity with settings:

...
      ->setRequired(TRUE)
      ->setDisplayOptions('form', [
        'type' => 'plugin_reference_select',
        'settings' => ['provider_grouping' => FALSE],
      ])
      ->setDisplayOptions('view', ['type' => 'plugin_reference_label']);
...

The plugin configuration form must have the required fields.

- Go to the entity editing form
- Do not fill in the required form fields
- Try changing the selected value several times
- You will notice that the configuration form does not change

This will be very noticeable when plugins have different fields.

This happens because the form does not pass validation.

Proposed resolution

Validate only when trigger is a button

CommentFileSizeAuthor
#3 3473082-2-validate-widget-fix.patch881 byteslukasss
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lukasss created an issue. See original summary.

lukasss’s picture

Title: Unnecessary validation in select widgets » Unnecessary validate in select type widgets
lukasss’s picture

StatusFileSize
new881 bytes
lukasss’s picture

Status: Active » Needs review
lukasss’s picture

Assigned: lukasss » Unassigned

jeroent made their first commit to this issue’s fork.

  • jeroent committed de615935 on 3.0.x
    Resolve #3473082 "Unnecessary validate in"
    
jeroent’s picture

Status: Needs review » Fixed

Merged to 3.0.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.