statamic / ideas

💡Discussions on ideas and feature requests for Statamic
https://statamic.dev
32 stars 1 forks source link

Field conditions on related entries #1267

Open wesort opened 2 days ago

wesort commented 2 days ago

Following on from this Discord thread, I found it unintuitive how to conditionally show/hide fields based on the value of an Entries field. I tried the docs for Conditional Fields, but it doesn't include this.

Context

Condition that does not work

Solution / Workaround


- The above will show the `Video meta info` field if a user chooses `Video` or `Interview` for the `Archive type`.

I could raise a PR for the docs if someone feels this would be useful. Being able to _select_ the relevant entries in the Conditions UI would be even better, but I'm not sure how many people using this approach.
daun commented 2 days ago

I was thinking this might be a good use case for a custom field condition to query against the slug and makes this a bit more readable, but that probably doesn't work since the data inside the conditions would be just the id, right? So no way to query the slug without major contortions.