Hi,
In my content type with only one field as required, the title field, I get the error "The title field is required" when I save the node. It is curious if I add a new field as required, for example: the body field, then I don't get any errors after saving the node.
I'm using the development version with the last commit "drupal/yoast_seo": "2.x-dev#9fb7e37"

Thanks!

Comments

gemalm created an issue. See original summary.

SaraKlasson’s picture

I get the same error for yoast_seo version “2.0.0-alpha3" on Drupal version 8.5.8

When I create new content I get validation error messages for all the required fields I have filled in. It looks like a loop that runs through the fields.
This happens although the fields are filled in correctly and the content is saved.
It is only for creating new content, not editing. This has happened on two different sites for me.

robin.ingelbrecht’s picture

This is fixed in the dev version

gemalm’s picture

Hi Robin,

As I explained in the issue, when I have more than one field required I don't get the errors but if I only have the title fieled as required I get this error. I tested installing the last commit of the dev version.

SaraKlasson’s picture

Hi, I am using 2.0.0-alpha3 to solve the problem described here https://www.drupal.org/project/yoast_seo/issues/2843302,
so thats why I am not using the dev version.

SaraKlasson’s picture

Hi, I am using 2.0.0-alpha3 to solve the problem described here https://www.drupal.org/project/yoast_seo/issues/2843302.
I need the analysis method that requires no specific fields to be present, so thats why I am not using the dev version.

SaraKlasson’s picture

I am now using version “2.x-dev#9fb7e37" but when creating new content I still get validation error messages for all mandatory fields when the content has been saved.

SaraKlasson’s picture

The problem is the line this.$form.find('.yoast-seo-preview-submit-button').mousedown(); in yoast_seo.js.
It submits the whole form (not only the yoast part) with the empty required fields when the form loads, and then these error messages are shown after saving.

SaraKlasson’s picture

So I found my problem now, which was on our end in a custom module. Yoast is calling the preview function on the node that I was creating and in some custom code there was a call to `$entity->toUrl()->toString()` which will throw an exception when the node isn’t actually created yet. So now I’m catching the exception and it works.

tbsiqueira’s picture

Hi, I'm having the same issue, I tried @SaraKlasson solution but had no success.

kingdutch’s picture

Thanks for pinning down the issue Sara, that sounds like it should be fixed with #3110455: Metatags depending on URL cause errors for unsaved entities after updating to Drupal 8.8.0

edgarmxl’s picture

StatusFileSize
new584 bytes

I am having the same issue, however, it seems adding '#limit_validation_errors' => [], into src/Form/AnalysisFormHandler.php:129 as:

    $element['yoast_seo_preview_button'] = [
      '#type' => 'button',
      '#value' => t('Seo preview'),
      '#limit_validation_errors' => [],
      '#attributes' => [
        'class' => ['yoast-seo-preview-submit-button'],
        // Inline styles are bad but we can't reliably use class order here.
        'style' => 'display: none',
      ],
      '#ajax' => [
        'callback' => [$this, 'analysisSubmitAjax'],
      ],
    ];

Solved the issue.

nixou’s picture

Status: Closed (duplicate) » Needs review

I can confirm the bug is still present (for example when uploading an image in the node edition form) and the last patch yoast_seo-3010164-12.patch needs to be applied to solve it.