Skip to content

Conversation

@ollieabbey
Copy link

@ollieabbey ollieabbey commented Nov 12, 2025

What?

See #14564.

If a collection used in a relationship has useAsTitle configured, use this in the validation message if it fails filterOptions validation.

If the collection does not have this set, fallback to the id as it currently uses.

Spotted a couple of small fixes during making this change too:

  1. If a collection has multiple relationTo types, the check for falseCollections was not correctly being applied, meaning filterOptions validation could succeed when passing an invalid collection. I've added a test for this and fixed.
  2. The error message had a trailing comma, I've removed this and tested it's gone.

Why?

Improved UX on the front end when this validation fails. It's a tricky situation to get into as the filterOptions should prevent you from choosing one of these options. But if a relationship was added before the filterOptions was configured then a previously valid relationship could become invalid, and this error appears. It also appears when using the API.

How?

In the filterOptions validation function, if required, lookup the relationship by its ID and use the titleField on the existing error message.

Before & after screenshots (different collections, but you get the idea)

image image
@ollieabbey ollieabbey force-pushed the improve_validation_of_relationships branch from a536b96 to a53a7c7 Compare November 13, 2025 09:00
@ollieabbey ollieabbey force-pushed the improve_validation_of_relationships branch from a53a7c7 to 6c00b84 Compare November 13, 2025 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant