Contentful logo

Contentful Community

Validating references based on related values

I’m building a content model for matches played in a tournament. Each match will have the following fields:

  • Player 1 (reference to a ‘Player’ content type)
  • Player 2 (reference to a ‘Player’ content type)
  • Winner (reference to a ‘Player’ content type)

I want to add validation to make sure that the winner can only be a reference to one of the two players who have already been added to the Player 1 or Player 2 slots. Is this possible using validation tools in the web app? Is there a better way to achieve the same result?

Cheers!

It is not possible to use the validation tools in the web app, as the default validation is on content types but not on entries.
For this use case, you will need to build a custom UI extension: https://github.com/contentful/extensions