Skip to content

[4.x]: Craft unexpectedly validates related element field in other site(s) #13907

Closed
@cdccairns

Description

@cdccairns

What happened?

Description

Our installation contains multiple Sites in multiple languages (English, Dutch, French, and German) and a Single section with a required Asset field. The Single section is enabled on multiple Sites, but not the primary site. The option Validate related assets is checked for the Asset field.

The asset itself (an image) has a required custom field (for alt text). This field is translatable per language. The purpose of this setup is to ensure that content managers cannot save an entry without first adding a valid alt text to the related image.

When an image is added via a secondary site whose language (English) does not match that of the primary site (Dutch), and an alt text is correctly added in the secondary language (English), it is not possible to save the entry without first entering an alt text in the language of the primary site (Dutch).

This is problematic for content managers who are unaware of the underlying validation logic and/or who do not have the necessary permissions to add an alt text in the language of the primary site.

Steps to reproduce

  1. Set up two Sites in different languages. Set one as the primary site.
  2. Add a Single section and enable it on both sites.
  3. Add a required Asset field to the Single section and check the option Validate related assets.
  4. Add a required Plain Text field to the Asset which is translated for each language.
  5. Upload a new image to the Single section via the secondary site.
  6. Enter a value into the required Plain Text field for the Asset.
  7. Save the entry.

Expected behavior

Craft considers the related asset valid for the current (secondary) site and saves the entry.

Actual behavior

Craft returns a validation error.

Craft CMS version

4.5.6.1

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions