Specify relation column as required
complete
Kai Doe
updated the status to
complete
Emilie Ringwald
Hey everyone, thanks for flagging this and for your patience, this has been one of our most requested relations fixes for a while.
Required relations are officially supported as of Strapi 5.51.2 (the enforcement landed in 5.51.1, the Content-Type Builder toggle followed right after in 5.51.2).
What changed: you can now check "Required" on a relation field in the Content-Type Builder, just like you would for any other field, and Strapi will actually block publishing an entry if that relation is empty. Drafts stay flexible, the check only kicks in when you hit publish.
One important thing to know: brand new projects get this enforcement turned on automatically. If you're on an existing project, you'll need to turn it on yourself by setting documents.strictRelations: true in your config/api.js. We made it opt-in for existing projects so we don't silently break anything currently relying on the old behavior.
Marking this as shipped. Let us know if you run into anything unexpected!
sc tester
Now, with conditional fields, we could almost build a button component which supports different "links". A text field with regex pattern to allow plain URLs and different relation fields to dynamically link to content inside of Strapi.
(And a field to select which link field is shown)
But as long as we can't make the relation fields required, it will happen that our content editors accidentally publish pages with "empty" (broken) links.
Nguyen Huu Kim
If you are using Strapi 5, you can try this one:
Bhavya Bhut
Any update?
B
Benjamin Schneider
how is it possible that this is still open after 6 years?!
KP
hi, any updates for making relationship field required?
V
Vladyslav Shestakov
Really need this
Derrick Mehaffy
Merged in a post:
Prevent users from creating entries when the relationships are missing
r
rinzler
In Strapi 4.16.2, we can make a normal field required from the admin interface. This prevents us from creating entries, when those required fields are missing, which is very useful.
Now, this feature does not exist for relationships, but we often need to do this too.
Now, we can manually add the "required: true" to the API's relationship, but this actually has no effect, i.e. it only shows the red asterisk close to relationship field (in the content manager), but we can still create the entry without specifying a value for that relationship.
This is actually more a bug than a feature, but may also be feature, in case you never planned to make relationships required.
This is so important. I know many people need this feature. So, please, implement this asap. Thanks.
A
Ashxdev
hi, any updates here?
Load More
→