Problem/Motivation

By adding the validator on the form level in combination with the required_api module which adds a validator on a submit. This makes it so that the submit validator looks for the form validation on the lowest level which is the submit validation. This makes it so that the geocoder validator is not fired and thus does not remove the third party settings.

Any module that adds their validation on submit will be prioritized and thus the validation on form level with not fire.
Related core issue.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork geocoder-3521182

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

reinout vanhauwaert created an issue. See original summary.

davidiio’s picture

Hello,

We had this error showing when trying to edit any field using geocoder:

Attempt to update field Coordinates failed: The configuration property third_party_settings.geocoder_field.providers.googlemaps.checked doesn't exist.

note: We also use other modules affecting form field like field_permissions or required_by_role

After applying patch from this issue merge request error disapeared and field config was saved :)

Thanks :)

davidiio’s picture

Status: Active » Needs review
itamair’s picture

  • itamair committed b9b0c9ec on 8.x-4.x
    Issue #3521182: The validator that is being added to the...
itamair’s picture

Status: Needs review » Fixed

thanks. Committed into 8.x-4.x-dev

Status: Fixed » Closed (fixed)

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

jasonsafro’s picture

This fix introduces a bug. Core and other modules put their validation handlers into `$form['#validate']`.

When you add validation to `$form['actions']['submit']['#validate']`, Drupal does not run the validations in `$form['#validate']`.

You can see what validations are being executed if you drop a breakpoint in `\Drupal\Core\Form\FormValidator::executeValidateHandlers()` and look at `$handlers`.